From 97a6196df2b73d43d317eab1543ca41f1f674d27 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 08:27:47 -0400 Subject: [PATCH 01/28] feat(logging): Drop support for Python 3.7, 3.8, 3.9 --- .../google-cloud-logging/CONTRIBUTING.rst | 14 ++++------- .../google/cloud/logging_v2/client.py | 2 +- packages/google-cloud-logging/noxfile.py | 10 ++++---- packages/google-cloud-logging/pytest.ini | 8 ------- packages/google-cloud-logging/setup.py | 2 +- .../testing/constraints-3.10.txt | 13 +++++----- .../tests/unit/test_logger.py | 11 --------- .../lower_bound_checker.py | 24 +++++++++++++++---- 8 files changed, 37 insertions(+), 47 deletions(-) diff --git a/packages/google-cloud-logging/CONTRIBUTING.rst b/packages/google-cloud-logging/CONTRIBUTING.rst index 1e7146486737..621f0ad35577 100644 --- a/packages/google-cloud-logging/CONTRIBUTING.rst +++ b/packages/google-cloud-logging/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows. + 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -195,11 +195,11 @@ configure them just like the System Tests. # Run all tests in a folder $ cd samples/snippets - $ nox -s py-3.8 + $ nox -s py-3.10 # Run a single sample test $ cd samples/snippets - $ nox -s py-3.8 -- -k + $ nox -s py-3.10 -- -k ******************************************** Note About ``README`` as it pertains to PyPI @@ -221,18 +221,12 @@ Supported Python Versions We support: -- `Python 3.7`_ -- `Python 3.8`_ -- `Python 3.9`_ - `Python 3.10`_ - `Python 3.11`_ - `Python 3.12`_ - `Python 3.13`_ - `Python 3.14`_ -.. _Python 3.7: https://docs.python.org/3.7/ -.. _Python 3.8: https://docs.python.org/3.8/ -.. _Python 3.9: https://docs.python.org/3.9/ .. _Python 3.10: https://docs.python.org/3.10/ .. _Python 3.11: https://docs.python.org/3.11/ .. _Python 3.12: https://docs.python.org/3.12/ @@ -245,7 +239,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/google-cloud-python/blob/main/noxfile.py -We also explicitly decided to support Python 3 beginning with version 3.7. +We also explicitly decided to support Python 3 beginning with version 3.10. Reasons for this include: - Encouraging use of newest versions of Python 3 diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/client.py index 7f0e62d58700..66f49c058248 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/client.py @@ -383,7 +383,7 @@ def get_default_handler(self, **kw): elif monitored_resource.type == _GKE_RESOURCE_TYPE: return StructuredLogHandler(**kw, project_id=self.project) elif monitored_resource.type == _GCF_RESOURCE_TYPE: - # __stdout__ stream required to support structured logging on Python 3.7 + # __stdout__ stream required to support structured logging on Google Cloud Functions kw["stream"] = kw.get("stream", sys.__stdout__) return StructuredLogHandler(**kw, project_id=self.project) elif monitored_resource.type == _RUN_RESOURCE_TYPE: diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index 6b5ca5479c27..6a5f21050304 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -47,7 +47,9 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" +) PACKAGE_NAME = "google-cloud-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -55,7 +57,7 @@ "asyncmock", "pytest", "pytest-cov", - "pytest-asyncio", + "pytest-asyncio==0.23.8", ] UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = [ "flask", @@ -111,7 +113,7 @@ def mypy(session): @nox.session def update_lower_bounds(session): """Update lower bounds in constraints.txt to match setup.py""" - session.install("google-cloud-testutils") + session.install("../google-cloud-testutils") session.install(".") session.run( @@ -127,7 +129,7 @@ def update_lower_bounds(session): @nox.session def check_lower_bounds(session): """Check lower bounds in setup.py are reflected in constraints file""" - session.install("google-cloud-testutils") + session.install("../google-cloud-testutils") session.install(".") session.run( diff --git a/packages/google-cloud-logging/pytest.ini b/packages/google-cloud-logging/pytest.ini index 414f82a6cc7e..942b21e9081b 100644 --- a/packages/google-cloud-logging/pytest.ini +++ b/packages/google-cloud-logging/pytest.ini @@ -13,14 +13,6 @@ filterwarnings = ignore:get_mtls_endpoint_and_cert_source is deprecated.:DeprecationWarning # DeprecationWarnings triggered by Flask 1.0 testing by Flask dependencies in test code ignore:Importing 'itsdangerous.json' is deprecated and will be removed in ItsDangerous 2.1:DeprecationWarning - # 3.7 deprecation warnings, remove after support for Python 3.7 is dropped - ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning - ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working:DeprecationWarning - ignore:You are using a non-supported Python version \(3\.7:FutureWarning - # 3.8 deprecation warnings, remove after support for Python 3.8 is dropped - ignore:You are using a non-supported Python version \(3\.8:FutureWarning - # 3.9 deprecation warnings, remove after support for Python 3.9 is dropped - ignore:You are using a Python version \(3\.9:FutureWarning # 3.10 deprecation warnings, remove after support for Python 3.10 is dropped ignore:You are using a Python version \(3\.10:FutureWarning ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working:DeprecationWarning diff --git a/packages/google-cloud-logging/setup.py b/packages/google-cloud-logging/setup.py index 7ed07b2aefc5..0bfdbf6ad2fd 100644 --- a/packages/google-cloud-logging/setup.py +++ b/packages/google-cloud-logging/setup.py @@ -47,7 +47,7 @@ "google-cloud-audit-log >= 0.3.1, < 1.0.0", "google-cloud-core >= 2.0.0, <3.0.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", - "opentelemetry-api >= 1.9.0", + "opentelemetry-api >= 1.28.1", "grpcio >= 1.44.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index bac7ba85b4ee..2f9876616ed9 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -1,11 +1,10 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file, -# pinning their versions to their lower bounds. -# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", -# then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 +google-cloud-appengine-logging==0.1.3 +google-cloud-audit-log==0.3.1 +google-cloud-core==2.0.0 +grpc-google-iam-v1==0.12.4 grpcio==1.44.0 +opentelemetry-api==1.28.1 proto-plus==1.22.3 -protobuf==4.25.8 +protobuf==4.25.8 \ No newline at end of file diff --git a/packages/google-cloud-logging/tests/unit/test_logger.py b/packages/google-cloud-logging/tests/unit/test_logger.py index 852a45e38b35..2b66bcda1020 100644 --- a/packages/google-cloud-logging/tests/unit/test_logger.py +++ b/packages/google-cloud-logging/tests/unit/test_logger.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest from copy import deepcopy from datetime import datetime, timedelta, timezone @@ -467,8 +466,6 @@ def test_log_w_dict_resource(self): Users should be able to input a dictionary with type and labels instead of a Resource object """ - import pytest - MESSAGE = "hello world" client = _Client(self.PROJECT) api = client.logging_api = _DummyLoggingAPI() @@ -1773,10 +1770,6 @@ def test_context_mgr_failure(self): self.assertEqual(list(batch.entries), UNSENT) self.assertIsNone(api._write_entries_called_with) - @pytest.mark.skipif( - sys.version_info < (3, 8), - reason="InvalidArgument init with details requires python3.8+", - ) def test_append_context_to_error(self): """ If an InvalidArgument exception contains info on the log that threw it, @@ -1826,10 +1819,6 @@ def test_append_context_to_error(self): err.message, starting_message, "message should have been unchanged" ) - @pytest.mark.skipif( - sys.version_info < (3, 8), - reason="InvalidArgument init with details requires python3.8+", - ) def test_batch_error_gets_context(self): """ Simulate an InvalidArgument sent as part of a batch commit, to ensure diff --git a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py index 64e52abeefe4..aa413e99ede1 100644 --- a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py +++ b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py @@ -22,13 +22,14 @@ import importlib.metadata as metadata -def _get_package_requirements(package_name: str) -> List[Requirement]: +def _get_package_requirements(package_name: str, env: dict = None) -> List[Requirement]: """ Get a list of all requirements and extras declared by this package. The package must already be installed in the environment. Args: package_name (str): The name of the package. + env (dict): Optional environment dictionary for marker evaluation. Returns: List[packaging.requirements.Requirement]: A list of package requirements and extras. @@ -36,7 +37,12 @@ def _get_package_requirements(package_name: str) -> List[Requirement]: requirements = [] distribution = metadata.distribution(package_name) if distribution.requires: - requirements = [Requirement(str(r)) for r in distribution.requires] + for r in distribution.requires: + req = Requirement(str(r)) + if req.marker and env: + if not req.marker.evaluate(env): + continue + requirements.append(req) return requirements @@ -121,7 +127,7 @@ def _lower_bound(requirement: Requirement) -> str: Returns: str: The lower bound for the requirement. """ - spec_set = list(requirement.specifier) + spec_set = [spec for spec in requirement.specifier if spec.operator != "!="] # sort by operator: <, then >= spec_set.sort(key=lambda x: x.operator) @@ -189,7 +195,11 @@ def update(ctx: click.Context, package_name: str, constraints_file: str) -> None If the constraints file already exists the contents will be overwritten. """ - requirements = _get_package_requirements(package_name) + import re + match = re.search(r"constraints-(\d+\.\d+)\.txt", constraints_file) + env = {"python_version": match.group(1)} if match else None + + requirements = _get_package_requirements(package_name, env=env) requirements.sort(key=lambda x: x.name) package_lower_bounds = list(_get_package_lower_bounds(ctx, requirements)) @@ -226,7 +236,11 @@ def check(ctx: click.Context, package_name: str, constraints_file: str): 3. package-name is already installed in the environment. """ - package_requirements = _get_package_requirements(package_name) + import re + match = re.search(r"constraints-(\d+\.\d+)\.txt", constraints_file) + env = {"python_version": match.group(1)} if match else None + + package_requirements = _get_package_requirements(package_name, env=env) constraints = _parse_requirements_file(constraints_file) package_lower_bounds = _get_package_lower_bounds(ctx, package_requirements) From 75d71a47e1d3bd9b3676116ed1f0954d1eb36a6b Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 08:38:30 -0400 Subject: [PATCH 02/28] chore(logging): Refine OpenTelemetry pin to 1.16.0 and add pytest-asyncio comments --- packages/google-cloud-logging/noxfile.py | 6 ++++++ packages/google-cloud-logging/pytest.ini | 2 ++ packages/google-cloud-logging/setup.py | 2 +- .../google-cloud-logging/testing/constraints-3.10.txt | 9 ++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index 6a5f21050304..402939d5a8d9 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -57,6 +57,9 @@ "asyncmock", "pytest", "pytest-cov", + # Pin pytest-asyncio to 0.23.8 to avoid strict event loop regressions + # in newer versions (v0.24+) which conflict with older grpcio (1.44.0) + # that does not automatically initialize loops in synchronous test threads. "pytest-asyncio==0.23.8", ] UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = [ @@ -265,6 +268,8 @@ def unit(session, protobuf_implementation): # Run py.test against the unit tests. session.run( "py.test", + "-W", + "ignore::DeprecationWarning", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=google", @@ -277,6 +282,7 @@ def unit(session, protobuf_implementation): *session.posargs, env={ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + "PYTHONWARNINGS": "ignore::DeprecationWarning", }, ) diff --git a/packages/google-cloud-logging/pytest.ini b/packages/google-cloud-logging/pytest.ini index 942b21e9081b..c75851b64dd9 100644 --- a/packages/google-cloud-logging/pytest.ini +++ b/packages/google-cloud-logging/pytest.ini @@ -20,6 +20,8 @@ filterwarnings = ignore:Attribute s is deprecated and will be removed in Python 3.14; use value instead:DeprecationWarning ignore:ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead:DeprecationWarning ignore:'pkgutil.get_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec\(\) instead:DeprecationWarning + # 3.14 deprecation warnings, remove after support for Python 3.14 is dropped + ignore:.*asyncio.iscoroutinefunction is deprecated and slated for removal in Python 3.16.*:DeprecationWarning # Remove warning once https://github.com/protocolbuffers/protobuf/issues/17345 is fixed ignore:.*Please use message_factory.GetMessageClass\(\) instead. SymbolDatabase.GetPrototype\(\) will be removed soon.:UserWarning # Remove warning once https://github.com/googleapis/gapic-generator-python/issues/2046 is fixed diff --git a/packages/google-cloud-logging/setup.py b/packages/google-cloud-logging/setup.py index 0bfdbf6ad2fd..c32b70772af9 100644 --- a/packages/google-cloud-logging/setup.py +++ b/packages/google-cloud-logging/setup.py @@ -47,7 +47,7 @@ "google-cloud-audit-log >= 0.3.1, < 1.0.0", "google-cloud-core >= 2.0.0, <3.0.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", - "opentelemetry-api >= 1.28.1", + "opentelemetry-api >= 1.16.0", "grpcio >= 1.44.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index 2f9876616ed9..ebdd89b80765 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -1,3 +1,10 @@ +# We use the constraints file for the latest Python version +# (currently this file) to check that the latest +# major versions of dependencies are supported in setup.py. +# List all library dependencies and extras in this file. +# Require the latest major version be installed for each dependency. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", +# Then this file should have google-cloud-foo>=1 google-api-core==2.17.1 google-auth==2.14.1 google-cloud-appengine-logging==0.1.3 @@ -5,6 +12,6 @@ google-cloud-audit-log==0.3.1 google-cloud-core==2.0.0 grpc-google-iam-v1==0.12.4 grpcio==1.44.0 -opentelemetry-api==1.28.1 +opentelemetry-api==1.16.0 proto-plus==1.22.3 protobuf==4.25.8 \ No newline at end of file From 43ae64d0da0bc58ee69eb44f78c96142146c4587 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 08:44:10 -0400 Subject: [PATCH 03/28] docs(logging): Clarify sys.__stdout__ GCF structured logging comment --- .../google-cloud-logging/google/cloud/logging_v2/client.py | 3 ++- packages/google-cloud-logging/noxfile.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/client.py index 66f49c058248..2770a17030e1 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/client.py @@ -383,7 +383,8 @@ def get_default_handler(self, **kw): elif monitored_resource.type == _GKE_RESOURCE_TYPE: return StructuredLogHandler(**kw, project_id=self.project) elif monitored_resource.type == _GCF_RESOURCE_TYPE: - # __stdout__ stream required to support structured logging on Google Cloud Functions + # Bypassing redirects via __stdout__ ensures structured logging + # works robustly on GCF even if stdout is redirected by wrappers. kw["stream"] = kw.get("stream", sys.__stdout__) return StructuredLogHandler(**kw, project_id=self.project) elif monitored_resource.type == _RUN_RESOURCE_TYPE: diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index 402939d5a8d9..a86781b11135 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -116,7 +116,7 @@ def mypy(session): @nox.session def update_lower_bounds(session): """Update lower bounds in constraints.txt to match setup.py""" - session.install("../google-cloud-testutils") + session.install("google-cloud-testutils") session.install(".") session.run( @@ -132,7 +132,7 @@ def update_lower_bounds(session): @nox.session def check_lower_bounds(session): """Check lower bounds in setup.py are reflected in constraints file""" - session.install("../google-cloud-testutils") + session.install("google-cloud-testutils") session.install(".") session.run( From 91c429a8a1361c8bf0419f45fd3c9712678874a4 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Tue, 26 May 2026 08:52:18 -0400 Subject: [PATCH 04/28] Update comment to match templated comment --- .../testing/constraints-3.10.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index ebdd89b80765..9ffd2e9e7b99 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -1,10 +1,9 @@ -# We use the constraints file for the latest Python version -# (currently this file) to check that the latest -# major versions of dependencies are supported in setup.py. -# List all library dependencies and extras in this file. -# Require the latest major version be installed for each dependency. -# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", -# Then this file should have google-cloud-foo>=1 +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file, +# pinning their versions to their lower bounds. +# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", +# then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 google-cloud-appengine-logging==0.1.3 From 07f5f4e7c72fe3966db0921c67a2a7271a05cc60 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 08:56:07 -0400 Subject: [PATCH 05/28] revert: Revert changes to lower_bound_checker --- .../lower_bound_checker.py | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py index aa413e99ede1..64e52abeefe4 100644 --- a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py +++ b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py @@ -22,14 +22,13 @@ import importlib.metadata as metadata -def _get_package_requirements(package_name: str, env: dict = None) -> List[Requirement]: +def _get_package_requirements(package_name: str) -> List[Requirement]: """ Get a list of all requirements and extras declared by this package. The package must already be installed in the environment. Args: package_name (str): The name of the package. - env (dict): Optional environment dictionary for marker evaluation. Returns: List[packaging.requirements.Requirement]: A list of package requirements and extras. @@ -37,12 +36,7 @@ def _get_package_requirements(package_name: str, env: dict = None) -> List[Requi requirements = [] distribution = metadata.distribution(package_name) if distribution.requires: - for r in distribution.requires: - req = Requirement(str(r)) - if req.marker and env: - if not req.marker.evaluate(env): - continue - requirements.append(req) + requirements = [Requirement(str(r)) for r in distribution.requires] return requirements @@ -127,7 +121,7 @@ def _lower_bound(requirement: Requirement) -> str: Returns: str: The lower bound for the requirement. """ - spec_set = [spec for spec in requirement.specifier if spec.operator != "!="] + spec_set = list(requirement.specifier) # sort by operator: <, then >= spec_set.sort(key=lambda x: x.operator) @@ -195,11 +189,7 @@ def update(ctx: click.Context, package_name: str, constraints_file: str) -> None If the constraints file already exists the contents will be overwritten. """ - import re - match = re.search(r"constraints-(\d+\.\d+)\.txt", constraints_file) - env = {"python_version": match.group(1)} if match else None - - requirements = _get_package_requirements(package_name, env=env) + requirements = _get_package_requirements(package_name) requirements.sort(key=lambda x: x.name) package_lower_bounds = list(_get_package_lower_bounds(ctx, requirements)) @@ -236,11 +226,7 @@ def check(ctx: click.Context, package_name: str, constraints_file: str): 3. package-name is already installed in the environment. """ - import re - match = re.search(r"constraints-(\d+\.\d+)\.txt", constraints_file) - env = {"python_version": match.group(1)} if match else None - - package_requirements = _get_package_requirements(package_name, env=env) + package_requirements = _get_package_requirements(package_name) constraints = _parse_requirements_file(constraints_file) package_lower_bounds = _get_package_lower_bounds(ctx, package_requirements) From 92ae3a47f286960e1f1918288c13d0114ce8a853 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 09:18:03 -0400 Subject: [PATCH 06/28] chore(logging): Resolve Python 3.14 asyncio deprecations in pytest.ini --- packages/google-cloud-logging/noxfile.py | 3 --- packages/google-cloud-logging/pytest.ini | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index a86781b11135..0d735fe174f4 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -268,8 +268,6 @@ def unit(session, protobuf_implementation): # Run py.test against the unit tests. session.run( "py.test", - "-W", - "ignore::DeprecationWarning", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=google", @@ -282,7 +280,6 @@ def unit(session, protobuf_implementation): *session.posargs, env={ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - "PYTHONWARNINGS": "ignore::DeprecationWarning", }, ) diff --git a/packages/google-cloud-logging/pytest.ini b/packages/google-cloud-logging/pytest.ini index c75851b64dd9..4c019fe6709b 100644 --- a/packages/google-cloud-logging/pytest.ini +++ b/packages/google-cloud-logging/pytest.ini @@ -21,7 +21,9 @@ filterwarnings = ignore:ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead:DeprecationWarning ignore:'pkgutil.get_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec\(\) instead:DeprecationWarning # 3.14 deprecation warnings, remove after support for Python 3.14 is dropped - ignore:.*asyncio.iscoroutinefunction is deprecated and slated for removal in Python 3.16.*:DeprecationWarning + ignore:.*asyncio.iscoroutinefunction.*is deprecated and slated for removal in Python 3.16:DeprecationWarning + ignore:.*asyncio.get_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning + ignore:.*asyncio.set_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning # Remove warning once https://github.com/protocolbuffers/protobuf/issues/17345 is fixed ignore:.*Please use message_factory.GetMessageClass\(\) instead. SymbolDatabase.GetPrototype\(\) will be removed soon.:UserWarning # Remove warning once https://github.com/googleapis/gapic-generator-python/issues/2046 is fixed From 25d6b1cc187c50164779d2b860de7103931c8780 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 09:37:03 -0400 Subject: [PATCH 07/28] feat(logging): Regenerate library and update librarian post-processing rules --- .../logging-integration.yaml | 35 +++++++- .../config_service_v2/async_client.py | 1 + .../services/config_service_v2/client.py | 1 + .../logging_service_v2/async_client.py | 1 + .../services/logging_service_v2/client.py | 1 + .../metrics_service_v2/async_client.py | 1 + .../services/metrics_service_v2/client.py | 1 + packages/google-cloud-logging/noxfile.py | 84 ++++++------------- .../testing/constraints-3.10.txt | 7 +- .../logging_v2/test_config_service_v2.py | 1 + .../logging_v2/test_logging_service_v2.py | 1 + .../logging_v2/test_metrics_service_v2.py | 1 + 12 files changed, 69 insertions(+), 66 deletions(-) diff --git a/.librarian/generator-input/client-post-processing/logging-integration.yaml b/.librarian/generator-input/client-post-processing/logging-integration.yaml index 567b536f47be..f608d579fa92 100644 --- a/.librarian/generator-input/client-post-processing/logging-integration.yaml +++ b/.librarian/generator-input/client-post-processing/logging-integration.yaml @@ -45,7 +45,7 @@ replacements: "google-cloud-audit-log >= 0.3.1, < 1.0.0", "google-cloud-core >= 2.0.0, <3.0.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", - "opentelemetry-api >= 1.9.0", + "opentelemetry-api >= 1.16.0", "grpcio >= 1.44.0, < 2.0.0", count: 1 - paths: [ @@ -464,3 +464,36 @@ replacements: # Enable mypy once this repo has been updated for mypy evaluation. session.skip("Skip mypy since this library is not yet updated for mypy evaluation") count: 1 + - paths: [ + packages/google-cloud-logging/noxfile.py + ] + before: | + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" + after: | + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) + count: 1 + - paths: [ + packages/google-cloud-logging/noxfile.py + ] + before: | + UNIT_TEST_STANDARD_DEPENDENCIES = \[ + \ "mock", + \ "asyncmock", + \ "pytest", + \ "pytest-cov", + \ "pytest-asyncio", + \] + after: | + UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + # Pin pytest-asyncio to 0.23.8 to avoid strict event loop regressions + # in newer versions (v0.24+) which conflict with older grpcio (1.44.0) + # that does not automatically initialize loops in synchronous test threads. + "pytest-asyncio==0.23.8", + ] + count: 1 diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py index 033ec1b5d8e9..8af0f0062939 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py @@ -15,6 +15,7 @@ # import logging as std_logging import re +import uuid from collections import OrderedDict from typing import ( Callable, diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py index f50ee5727529..3bbbc341a85d 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py @@ -17,6 +17,7 @@ import logging as std_logging import os import re +import uuid import warnings from collections import OrderedDict from http import HTTPStatus diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py index 7695d951eed8..07eb7fa1d970 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py @@ -15,6 +15,7 @@ # import logging as std_logging import re +import uuid from collections import OrderedDict from typing import ( AsyncIterable, diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py index c681c9cbd6e9..f5053b90c282 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py @@ -17,6 +17,7 @@ import logging as std_logging import os import re +import uuid import warnings from collections import OrderedDict from http import HTTPStatus diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py index ae820f49b3bf..4284496877e8 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py @@ -15,6 +15,7 @@ # import logging as std_logging import re +import uuid from collections import OrderedDict from typing import ( Callable, diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py index 5b3b406d8c5f..ebca299a786a 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py @@ -17,6 +17,7 @@ import logging as std_logging import os import re +import uuid import warnings from collections import OrderedDict from http import HTTPStatus diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index 0d735fe174f4..5a1a884f0013 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -513,50 +513,24 @@ def prerelease_deps(session, protobuf_implementation): "proto-plus", ] - deps_dir = CURRENT_DIRECTORY.parent - while deps_dir.name != "packages" and deps_dir.parent != deps_dir: - deps_dir = deps_dir.parent - - # Extract the base package name, safely ignoring version bounds and spaces - # (e.g., "grpcio>=1.75.1" becomes "grpcio") - parsed_deps = { - dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1) for dep in prerel_deps - } - - # Dynamically sort local packages vs PyPI dependencies - local_paths = [] - pypi_deps = [] - - for dep, pkg_name in parsed_deps.items(): - if (deps_dir / pkg_name).exists(): - local_paths.append(str(deps_dir / pkg_name)) - else: - pypi_deps.append(dep) - - # Batch pip installations to avoid sequential overhead - if local_paths: - session.install(*local_paths, "--no-deps", "--ignore-installed") - if pypi_deps: - session.install(*pypi_deps, "--pre", "--no-deps", "--ignore-installed") - - # TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status`` - # to the dictionary below once this bug is fixed. - # TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add - # `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below - # once this bug is fixed. - package_namespaces = { - "google-api-core": "google.api_core", - "google-auth": "google.auth", - "grpcio": "grpc", - "protobuf": "google.protobuf", - "proto-plus": "proto", - } - - # Reuse the parsed names for logging and version verification - for dep, pkg_name in parsed_deps.items(): - print(f"Installed {dep}") - version_namespace = package_namespaces.get(pkg_name) + for dep in prerel_deps: + session.install("--pre", "--no-deps", "--ignore-installed", dep) + # TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status`` + # to the dictionary below once this bug is fixed. + # TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add + # `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below + # once this bug is fixed. + package_namespaces = { + "google-api-core": "google.api_core", + "google-auth": "google.auth", + "grpcio": "grpc", + "protobuf": "google.protobuf", + "proto-plus": "proto", + } + + version_namespace = package_namespaces.get(dep) + print(f"Installed {dep}") if version_namespace: session.run( "python", @@ -626,24 +600,16 @@ def core_deps_from_source(session, protobuf_implementation): # Note: If a dependency is added to the `core_dependencies_from_source` list, # the `prerel_deps` list in the `prerelease_deps` nox session should also be updated. core_dependencies_from_source = [ - "googleapis-common-protos", - "google-api-core", - "google-auth", - "grpc-google-iam-v1", - "proto-plus", + "googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages/googleapis-common-protos", + "google-api-core @ git+https://github.com/googleapis/google-cloud-python#egg=google-api-core&subdirectory=packages/google-api-core", + "google-auth @ git+https://github.com/googleapis/google-cloud-python#egg=google-auth&subdirectory=packages/google-auth", + "grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages/grpc-google-iam-v1", + "proto-plus @ git+https://github.com/googleapis/google-cloud-python#egg=proto-plus&subdirectory=packages/proto-plus", ] - deps_dir = CURRENT_DIRECTORY.parent - while deps_dir.name != "packages" and deps_dir.parent != deps_dir: - deps_dir = deps_dir.parent - - # Batch the pip installation to avoid sequential overhead - dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source] - - session.install(*dep_paths, "--no-deps", "--ignore-installed") - print( - f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}" - ) + for dep in core_dependencies_from_source: + session.install(dep, "--no-deps", "--ignore-installed") + print(f"Installed {dep}") session.run( "py.test", diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index 9ffd2e9e7b99..bac7ba85b4ee 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -6,11 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -google-cloud-appengine-logging==0.1.3 -google-cloud-audit-log==0.3.1 -google-cloud-core==2.0.0 -grpc-google-iam-v1==0.12.4 grpcio==1.44.0 -opentelemetry-api==1.16.0 proto-plus==1.22.3 -protobuf==4.25.8 \ No newline at end of file +protobuf==4.25.8 diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index b4ded2e4b7af..9725473cba34 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -16,6 +16,7 @@ import json import math import os +import re from collections.abc import Mapping, Sequence from unittest import mock from unittest.mock import AsyncMock diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 15fc2e936161..5db80da788f2 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -16,6 +16,7 @@ import json import math import os +import re from collections.abc import Mapping, Sequence from unittest import mock from unittest.mock import AsyncMock diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 51904674ac2a..0ea14727c19f 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -16,6 +16,7 @@ import json import math import os +import re from collections.abc import Mapping, Sequence from unittest import mock from unittest.mock import AsyncMock From 0a5f10f220bc701c656a43ca3f6c04f14d2b976e Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 11:04:06 -0400 Subject: [PATCH 08/28] feat(logging): Universalize constraints path and grpcio requirements in gapic-generator templates --- .../logging-integration.yaml | 33 -------- .../gapic/templates/noxfile.py.j2 | 7 +- .../gapic/templates/setup.py.j2 | 2 +- .../config_service_v2/async_client.py | 1 - .../services/config_service_v2/client.py | 1 - .../logging_service_v2/async_client.py | 1 - .../services/logging_service_v2/client.py | 1 - .../metrics_service_v2/async_client.py | 1 - .../services/metrics_service_v2/client.py | 1 - packages/google-cloud-logging/noxfile.py | 84 +++++++++++++------ packages/google-cloud-logging/pytest.ini | 1 - .../logging_v2/test_config_service_v2.py | 1 - .../logging_v2/test_logging_service_v2.py | 1 - .../logging_v2/test_metrics_service_v2.py | 1 - 14 files changed, 66 insertions(+), 70 deletions(-) diff --git a/.librarian/generator-input/client-post-processing/logging-integration.yaml b/.librarian/generator-input/client-post-processing/logging-integration.yaml index f608d579fa92..6b32d5db3f3d 100644 --- a/.librarian/generator-input/client-post-processing/logging-integration.yaml +++ b/.librarian/generator-input/client-post-processing/logging-integration.yaml @@ -464,36 +464,3 @@ replacements: # Enable mypy once this repo has been updated for mypy evaluation. session.skip("Skip mypy since this library is not yet updated for mypy evaluation") count: 1 - - paths: [ - packages/google-cloud-logging/noxfile.py - ] - before: | - LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" - after: | - LOWER_BOUND_CONSTRAINTS_FILE = ( - CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" - ) - count: 1 - - paths: [ - packages/google-cloud-logging/noxfile.py - ] - before: | - UNIT_TEST_STANDARD_DEPENDENCIES = \[ - \ "mock", - \ "asyncmock", - \ "pytest", - \ "pytest-cov", - \ "pytest-asyncio", - \] - after: | - UNIT_TEST_STANDARD_DEPENDENCIES = [ - "mock", - "asyncmock", - "pytest", - "pytest-cov", - # Pin pytest-asyncio to 0.23.8 to avoid strict event loop regressions - # in newer versions (v0.24+) which conflict with older grpcio (1.44.0) - # that does not automatically initialize loops in synchronous test threads. - "pytest-asyncio==0.23.8", - ] - count: 1 diff --git a/packages/gapic-generator/gapic/templates/noxfile.py.j2 b/packages/gapic-generator/gapic/templates/noxfile.py.j2 index db4a29fcf9db..5ce51804e637 100644 --- a/packages/gapic-generator/gapic/templates/noxfile.py.j2 +++ b/packages/gapic-generator/gapic/templates/noxfile.py.j2 @@ -41,7 +41,12 @@ PREVIEW_PYTHON_VERSION = "3.14" CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "{{ api.naming.warehouse_package_name }}" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/gapic/templates/setup.py.j2 b/packages/gapic-generator/gapic/templates/setup.py.j2 index b803e1b6df96..e1927bc48fe0 100644 --- a/packages/gapic-generator/gapic/templates/setup.py.j2 +++ b/packages/gapic-generator/gapic/templates/setup.py.j2 @@ -37,7 +37,7 @@ dependencies = [ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py index 8af0f0062939..033ec1b5d8e9 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/async_client.py @@ -15,7 +15,6 @@ # import logging as std_logging import re -import uuid from collections import OrderedDict from typing import ( Callable, diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py index 3bbbc341a85d..f50ee5727529 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/config_service_v2/client.py @@ -17,7 +17,6 @@ import logging as std_logging import os import re -import uuid import warnings from collections import OrderedDict from http import HTTPStatus diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py index 07eb7fa1d970..7695d951eed8 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py @@ -15,7 +15,6 @@ # import logging as std_logging import re -import uuid from collections import OrderedDict from typing import ( AsyncIterable, diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py index f5053b90c282..c681c9cbd6e9 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/logging_service_v2/client.py @@ -17,7 +17,6 @@ import logging as std_logging import os import re -import uuid import warnings from collections import OrderedDict from http import HTTPStatus diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py index 4284496877e8..ae820f49b3bf 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py @@ -15,7 +15,6 @@ # import logging as std_logging import re -import uuid from collections import OrderedDict from typing import ( Callable, diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py index ebca299a786a..5b3b406d8c5f 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/services/metrics_service_v2/client.py @@ -17,7 +17,6 @@ import logging as std_logging import os import re -import uuid import warnings from collections import OrderedDict from http import HTTPStatus diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index 5a1a884f0013..0d735fe174f4 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -513,24 +513,50 @@ def prerelease_deps(session, protobuf_implementation): "proto-plus", ] - for dep in prerel_deps: - session.install("--pre", "--no-deps", "--ignore-installed", dep) - # TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status`` - # to the dictionary below once this bug is fixed. - # TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add - # `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below - # once this bug is fixed. - package_namespaces = { - "google-api-core": "google.api_core", - "google-auth": "google.auth", - "grpcio": "grpc", - "protobuf": "google.protobuf", - "proto-plus": "proto", - } - - version_namespace = package_namespaces.get(dep) - + deps_dir = CURRENT_DIRECTORY.parent + while deps_dir.name != "packages" and deps_dir.parent != deps_dir: + deps_dir = deps_dir.parent + + # Extract the base package name, safely ignoring version bounds and spaces + # (e.g., "grpcio>=1.75.1" becomes "grpcio") + parsed_deps = { + dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1) for dep in prerel_deps + } + + # Dynamically sort local packages vs PyPI dependencies + local_paths = [] + pypi_deps = [] + + for dep, pkg_name in parsed_deps.items(): + if (deps_dir / pkg_name).exists(): + local_paths.append(str(deps_dir / pkg_name)) + else: + pypi_deps.append(dep) + + # Batch pip installations to avoid sequential overhead + if local_paths: + session.install(*local_paths, "--no-deps", "--ignore-installed") + if pypi_deps: + session.install(*pypi_deps, "--pre", "--no-deps", "--ignore-installed") + + # TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status`` + # to the dictionary below once this bug is fixed. + # TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add + # `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below + # once this bug is fixed. + package_namespaces = { + "google-api-core": "google.api_core", + "google-auth": "google.auth", + "grpcio": "grpc", + "protobuf": "google.protobuf", + "proto-plus": "proto", + } + + # Reuse the parsed names for logging and version verification + for dep, pkg_name in parsed_deps.items(): print(f"Installed {dep}") + version_namespace = package_namespaces.get(pkg_name) + if version_namespace: session.run( "python", @@ -600,16 +626,24 @@ def core_deps_from_source(session, protobuf_implementation): # Note: If a dependency is added to the `core_dependencies_from_source` list, # the `prerel_deps` list in the `prerelease_deps` nox session should also be updated. core_dependencies_from_source = [ - "googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages/googleapis-common-protos", - "google-api-core @ git+https://github.com/googleapis/google-cloud-python#egg=google-api-core&subdirectory=packages/google-api-core", - "google-auth @ git+https://github.com/googleapis/google-cloud-python#egg=google-auth&subdirectory=packages/google-auth", - "grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages/grpc-google-iam-v1", - "proto-plus @ git+https://github.com/googleapis/google-cloud-python#egg=proto-plus&subdirectory=packages/proto-plus", + "googleapis-common-protos", + "google-api-core", + "google-auth", + "grpc-google-iam-v1", + "proto-plus", ] - for dep in core_dependencies_from_source: - session.install(dep, "--no-deps", "--ignore-installed") - print(f"Installed {dep}") + deps_dir = CURRENT_DIRECTORY.parent + while deps_dir.name != "packages" and deps_dir.parent != deps_dir: + deps_dir = deps_dir.parent + + # Batch the pip installation to avoid sequential overhead + dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source] + + session.install(*dep_paths, "--no-deps", "--ignore-installed") + print( + f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}" + ) session.run( "py.test", diff --git a/packages/google-cloud-logging/pytest.ini b/packages/google-cloud-logging/pytest.ini index 4c019fe6709b..79064c787f9f 100644 --- a/packages/google-cloud-logging/pytest.ini +++ b/packages/google-cloud-logging/pytest.ini @@ -22,7 +22,6 @@ filterwarnings = ignore:'pkgutil.get_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec\(\) instead:DeprecationWarning # 3.14 deprecation warnings, remove after support for Python 3.14 is dropped ignore:.*asyncio.iscoroutinefunction.*is deprecated and slated for removal in Python 3.16:DeprecationWarning - ignore:.*asyncio.get_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning ignore:.*asyncio.set_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning # Remove warning once https://github.com/protocolbuffers/protobuf/issues/17345 is fixed ignore:.*Please use message_factory.GetMessageClass\(\) instead. SymbolDatabase.GetPrototype\(\) will be removed soon.:UserWarning diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index 9725473cba34..b4ded2e4b7af 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -16,7 +16,6 @@ import json import math import os -import re from collections.abc import Mapping, Sequence from unittest import mock from unittest.mock import AsyncMock diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 5db80da788f2..15fc2e936161 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -16,7 +16,6 @@ import json import math import os -import re from collections.abc import Mapping, Sequence from unittest import mock from unittest.mock import AsyncMock diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 0ea14727c19f..51904674ac2a 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -16,7 +16,6 @@ import json import math import os -import re from collections.abc import Mapping, Sequence from unittest import mock from unittest.mock import AsyncMock From 4d70fe785ab3670b4e81772a6144b60c24d117aa Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 11:07:12 -0400 Subject: [PATCH 09/28] chore(logging): Restore asyncio.get_event_loop_policy warning filter in pytest.ini --- packages/google-cloud-logging/pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-logging/pytest.ini b/packages/google-cloud-logging/pytest.ini index 79064c787f9f..4c019fe6709b 100644 --- a/packages/google-cloud-logging/pytest.ini +++ b/packages/google-cloud-logging/pytest.ini @@ -22,6 +22,7 @@ filterwarnings = ignore:'pkgutil.get_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec\(\) instead:DeprecationWarning # 3.14 deprecation warnings, remove after support for Python 3.14 is dropped ignore:.*asyncio.iscoroutinefunction.*is deprecated and slated for removal in Python 3.16:DeprecationWarning + ignore:.*asyncio.get_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning ignore:.*asyncio.set_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning # Remove warning once https://github.com/protocolbuffers/protobuf/issues/17345 is fixed ignore:.*Please use message_factory.GetMessageClass\(\) instead. SymbolDatabase.GetPrototype\(\) will be removed soon.:UserWarning From 0880b033a6e78a2e12e274c082feec47f75bc130 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 11:14:24 -0400 Subject: [PATCH 10/28] feat(generator): Universalize constraints path and grpcio requirement in gapic-generator templates --- packages/gapic-generator/gapic/templates/noxfile.py.j2 | 7 ++++++- packages/gapic-generator/gapic/templates/setup.py.j2 | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/gapic-generator/gapic/templates/noxfile.py.j2 b/packages/gapic-generator/gapic/templates/noxfile.py.j2 index db4a29fcf9db..5ce51804e637 100644 --- a/packages/gapic-generator/gapic/templates/noxfile.py.j2 +++ b/packages/gapic-generator/gapic/templates/noxfile.py.j2 @@ -41,7 +41,12 @@ PREVIEW_PYTHON_VERSION = "3.14" CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "{{ api.naming.warehouse_package_name }}" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/gapic/templates/setup.py.j2 b/packages/gapic-generator/gapic/templates/setup.py.j2 index b803e1b6df96..e1927bc48fe0 100644 --- a/packages/gapic-generator/gapic/templates/setup.py.j2 +++ b/packages/gapic-generator/gapic/templates/setup.py.j2 @@ -37,7 +37,7 @@ dependencies = [ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", From ccc69447f8293c096ff5c81ffa7e5b8b83fb3f4d Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 11:14:40 -0400 Subject: [PATCH 11/28] revert(logging): Revert local gapic-generator modifications from logging branch --- .../%name_%version/%sub/test_%service.py.j2 | 9 +- .../gapic/generator/generator.py | 3 - .../%sub/services/%service/_shared_macros.j2 | 10 +- .../%sub/services/%service/async_client.py.j2 | 2 +- .../%sub/services/%service/client.py.j2 | 32 - .../gapic/templates/noxfile.py.j2 | 7 +- .../gapic/templates/setup.py.j2 | 2 +- .../%name_%version/%sub/test_%service.py.j2 | 81 -- .../gapic/%name_%version/%sub/test_macros.j2 | 113 +- .../gapic-generator/gapic/utils/__init__.py | 2 - packages/gapic-generator/setup.py | 2 +- .../unit/gapic/asset_v1/test_asset_service.py | 621 +++++----- .../credentials_v1/test_iam_credentials.py | 108 +- .../unit/gapic/eventarc_v1/test_eventarc.py | 1053 +++++++++-------- .../logging_v2/test_config_service_v2.py | 832 ++++++------- .../logging_v2/test_logging_service_v2.py | 152 +-- .../logging_v2/test_metrics_service_v2.py | 130 +- .../logging_v2/test_config_service_v2.py | 832 ++++++------- .../logging_v2/test_logging_service_v2.py | 152 +-- .../logging_v2/test_metrics_service_v2.py | 130 +- .../unit/gapic/redis_v1/test_cloud_redis.py | 308 ++--- .../unit/gapic/redis_v1/test_cloud_redis.py | 140 ++- .../storage_batch_operations/async_client.py | 9 +- .../storage_batch_operations/client.py | 39 +- .../test_storage_batch_operations.py | 386 +++--- 25 files changed, 2541 insertions(+), 2614 deletions(-) diff --git a/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index e8953eb0742e..8f0bf28f7416 100644 --- a/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -70,10 +70,8 @@ from google.iam.v1 import policy_pb2 # type: ignore {% endfilter %} {{ shared_macros.add_google_api_core_version_header_import(service.version) }} -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} -_UUID4_RE = re.compile(r"{{ uuid4_re }}") -{% endif %} +{% with uuid4_re = "[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" %} def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -694,7 +692,7 @@ def test_{{ method_name }}_empty_call(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.match(args[0].{{ auto_populated_field }}) + assert re.fullmatch(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -732,7 +730,7 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.match(args[0].{{ auto_populated_field }}) + assert re.fullmatch(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -2490,4 +2488,5 @@ def test_client_ctx(): pass close.assert_called() +{% endwith %}{# uuid4_re #} {% endblock %} diff --git a/packages/gapic-generator/gapic/generator/generator.py b/packages/gapic-generator/gapic/generator/generator.py index 9fe56aa9de1d..e9e006e74884 100644 --- a/packages/gapic-generator/gapic/generator/generator.py +++ b/packages/gapic-generator/gapic/generator/generator.py @@ -75,9 +75,6 @@ def __init__(self, opts: Options) -> None: self._env.tests["str_field_pb"] = utils.is_str_field_pb self._env.tests["msg_field_pb"] = utils.is_msg_field_pb - # Add global variables. - self._env.globals["uuid4_re"] = utils.UUID4_RE - self._sample_configs = opts.sample_configs def get_response(self, api_schema: api.API, opts: Options) -> CodeGeneratorResponse: diff --git a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 index 755e4530e7ba..81c9a11a07e4 100644 --- a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 +++ b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 @@ -14,7 +14,7 @@ # limitations under the License. #} -{% macro auto_populate_uuid4_fields(api, method, is_async=False) %} +{% macro auto_populate_uuid4_fields(api, method) %} {# Automatically populate UUID4 fields according to https://google.aip.dev/client-libraries/4235 when the @@ -27,12 +27,12 @@ {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} - {% set is_proto3_optional = method.input.fields[auto_populated_field].proto3_optional %} - {% if is_async %} - self._client._setup_request_id(request, '{{ auto_populated_field }}', {{ is_proto3_optional }}) + {% if method.input.fields[auto_populated_field].proto3_optional %} + if '{{ auto_populated_field }}' not in request: {% else %} - self._setup_request_id(request, '{{ auto_populated_field }}', {{ is_proto3_optional }}) + if not request.{{ auto_populated_field }}: {% endif %} + request.{{ auto_populated_field }} = str(uuid.uuid4()) {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} diff --git a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 6e604b035141..2865a61657e6 100644 --- a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -395,7 +395,7 @@ class {{ service.async_client_name }}: {{ shared_macros.create_metadata(method) }} {{ shared_macros.add_api_version_header_to_metadata(service.version) }} -{{ shared_macros.auto_populate_uuid4_fields(api, method, is_async=True) }} +{{ shared_macros.auto_populate_uuid4_fields(api, method) }} # Validate the universe domain. self._client._validate_universe_domain() diff --git a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index 2579d0dcf2fd..078d6862beae 100644 --- a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -453,38 +453,6 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): # NOTE (b/349488459): universe validation is disabled until further notice. return True - {% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} - @staticmethod - def _setup_request_id(request, field_name: str, is_proto3_optional: bool): - """Populate a UUID4 field in the request if it is not already set. - - Args: - request (Union[google.protobuf.message.Message, dict]): The request object. - field_name (str): The name of the field to populate. - is_proto3_optional (bool): Whether the field is proto3 optional. - """ - if isinstance(request, dict): - if is_proto3_optional: - if field_name not in request: - request[field_name] = str(uuid.uuid4()) - elif not request.get(field_name): - request[field_name] = str(uuid.uuid4()) - return - - if is_proto3_optional: - try: - # Pure protobuf messages - if not request.HasField(field_name): - setattr(request, field_name, str(uuid.uuid4())) - except (AttributeError, ValueError): - # Proto-plus messages or other objects - if field_name not in request: - setattr(request, field_name, str(uuid.uuid4())) - else: - if not getattr(request, field_name): - setattr(request, field_name, str(uuid.uuid4())) - {% endif %} - def _add_cred_info_for_auth_errors( self, error: core_exceptions.GoogleAPICallError diff --git a/packages/gapic-generator/gapic/templates/noxfile.py.j2 b/packages/gapic-generator/gapic/templates/noxfile.py.j2 index 5ce51804e637..db4a29fcf9db 100644 --- a/packages/gapic-generator/gapic/templates/noxfile.py.j2 +++ b/packages/gapic-generator/gapic/templates/noxfile.py.j2 @@ -41,12 +41,7 @@ PREVIEW_PYTHON_VERSION = "3.14" CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -if (CURRENT_DIRECTORY / "testing").exists(): - LOWER_BOUND_CONSTRAINTS_FILE = ( - CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" - ) -else: - LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "{{ api.naming.warehouse_package_name }}" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/gapic/templates/setup.py.j2 b/packages/gapic-generator/gapic/templates/setup.py.j2 index e1927bc48fe0..b803e1b6df96 100644 --- a/packages/gapic-generator/gapic/templates/setup.py.j2 +++ b/packages/gapic-generator/gapic/templates/setup.py.j2 @@ -37,7 +37,7 @@ dependencies = [ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.59.0, < 2.0.0", + "grpcio >= 1.44.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index bd5d5a42ff7f..1dba8773b919 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -106,9 +106,6 @@ CRED_INFO_JSON = { "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} -_UUID4_RE = re.compile(r"{{ uuid4_re }}") -{% endif %} async def mock_async_gen(data, chunk_size=1): @@ -418,84 +415,6 @@ def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): client._add_cred_info_for_auth_errors(error) assert error.details == [] -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} -def test__setup_request_id(): - class MockRequest: - def __init__(self, **kwargs): - for k, v in kwargs.items(): - setattr(self, k, v) - def __contains__(self, key): - return hasattr(self, key) - - class MockProtoRequest: - def __init__(self, **kwargs): - for k, v in kwargs.items(): - setattr(self, k, v) - def HasField(self, key): - return hasattr(self, key) - - # Test with proto3 optional field not in request - request = MockRequest() - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) - - # Test with proto3 optional field already in request - request = MockRequest(request_id="already_set") - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert request.request_id == "already_set" - - # Test with non-proto3 optional field empty - request = MockRequest(request_id="") - {{ service.client_name }}._setup_request_id(request, "request_id", False) - assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) - - # Test with non-proto3 optional field already set - request = MockRequest(request_id="already_set") - {{ service.client_name }}._setup_request_id(request, "request_id", False) - assert request.request_id == "already_set" - - # Test with proto3 optional field not in request (MockProtoRequest) - request = MockProtoRequest() - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) - - # Test with proto3 optional field already in request (MockProtoRequest) - request = MockProtoRequest(request_id="already_set") - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert request.request_id == "already_set" - - # Test with ValueError - class MockValueErrorRequest: - def HasField(self, key): - raise ValueError("Mismatched field") - def __contains__(self, key): - return hasattr(self, key) - - request = MockValueErrorRequest() - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) - - # Test with dict and proto3 optional field not in request - request = {} - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert re.match(r"{{ test_macros.get_uuid4_re() }}", request["request_id"]) - - # Test with dict and proto3 optional field already in request - request = {"request_id": "already_set"} - {{ service.client_name }}._setup_request_id(request, "request_id", True) - assert request["request_id"] == "already_set" - - # Test with dict and non-proto3 optional field empty - request = {"request_id": ""} - {{ service.client_name }}._setup_request_id(request, "request_id", False) - assert re.match(r"{{ test_macros.get_uuid4_re() }}", request["request_id"]) - - # Test with dict and non-proto3 optional field already set - request = {"request_id": "already_set"} - {{ service.client_name }}._setup_request_id(request, "request_id", False) - assert request["request_id"] == "already_set" - -{% endif %} @pytest.mark.parametrize("client_class,transport_name", [ {% if 'grpc' in opts.transport %} ({{ service.client_name }}, "grpc"), diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 index 648f2e868812..9e3f4be26b13 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 @@ -1,21 +1,11 @@ {% macro grpc_required_tests(method, service, api, full_extended_lro=False) %} -{%- set method_settings = api.all_method_settings.get(method.meta.address.proto) -%} -{%- set auto_populated_fields = method_settings.auto_populated_fields if method_settings else [] -%} -{%- set auto_populated_field_sample_value = "explicit value for autopopulate-able field" -%} {% with method_name = method.client_method_name|snake_case + "_unary" if method.extended_lro and not full_extended_lro else method.client_method_name|snake_case, method_output = method.extended_lro.operation_type if method.extended_lro and not full_extended_lro else method.output %} @pytest.mark.parametrize("request_type", [ - {{ method.input.ident }}({ - {% for auto_populated_field in auto_populated_fields %} - "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", - {% endfor %} - }), - { - {% for auto_populated_field in auto_populated_fields %} - "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", - {% endfor %} - }, + {{ method.input.ident }}, + dict, ]) def test_{{ method_name }}(request_type, transport: str = 'grpc'): + {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} client = {{ service.client_name }}( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -23,7 +13,18 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + {# Set UUID4 fields so that they are not automatically populated. #} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + if isinstance(request, dict): + request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" + else: + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} {% if method.client_streaming %} requests = [request] {% endif %} @@ -70,9 +71,13 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): assert next(args[0]) == request {% else %} request = {{ method.input.ident }}() - {% for auto_populated_field in auto_populated_fields %} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} assert args[0] == request {% endif %} @@ -113,9 +118,10 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% endif %}{# end oneof/optional #} {% endfor %} {% endif %} - {%- if not method.client_streaming %} + {% endwith %}{# auto_populated_field_sample_value #} +{% if not method.client_streaming %} def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. @@ -142,20 +148,20 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): call.assert_called() _, args, _ = call.mock_calls[0] {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} - request_msg = {{ method.input.ident }}( - {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} - {{ field.name }}={{ field.mock_value }}, - {% endfor %} - ) {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].{{ auto_populated_field }}) - request_msg.{{ auto_populated_field }} = args[0].{{ auto_populated_field }} + assert re.fullmatch(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} - assert args[0] == request_msg + assert args[0] == {{ method.input.ident }}( + {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} + {{ field.name }}={{ field.mock_value }}, + {% endfor %} + ) {% endif %} def test_{{ method_name }}_use_cached_wrapped_rpc(): @@ -259,19 +265,8 @@ async def test_{{ method_name }}_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - {{ method.input.ident }}({ - {%- for auto_populated_field in auto_populated_fields %} - "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", - {%- endfor %} - }), - { - {%- for auto_populated_field in auto_populated_fields %} - "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", - {%- endfor %} - }, -]) -async def test_{{ method_name }}_async(request_type, transport: str = 'grpc_asyncio'): +async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_type={{ method.input.ident }}): + {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} client = {{ service.async_client_name }}( credentials=async_anonymous_credentials(), transport=transport, @@ -279,7 +274,18 @@ async def test_{{ method_name }}_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + {# Set UUID4 fields so that they are not automatically populated. #} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + if isinstance(request, dict): + request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" + else: + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} {% if method.client_streaming %} requests = [request] {% endif %} @@ -329,9 +335,13 @@ async def test_{{ method_name }}_async(request_type, transport: str = 'grpc_asyn assert next(args[0]) == request {% else %} request = {{ method.input.ident }}() - {% for auto_populated_field in auto_populated_fields %} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} assert args[0] == request {% endif %} @@ -368,6 +378,12 @@ async def test_{{ method_name }}_async(request_type, transport: str = 'grpc_asyn {% endif %}{# oneof/optional #} {% endfor %} {% endif %} + {% endwith %}{# auto_populated_field_sample_value #} + + +@pytest.mark.asyncio +async def test_{{ method_name }}_async_from_dict(): + await test_{{ method_name }}_async(request_type=dict) {% endif %}{# full_extended_lro #} {% if method.field_headers and not method.client_streaming and not method.explicit_routing %} @@ -1208,7 +1224,7 @@ def test_{{ method_name }}_rest_required_fields(request_type={{ method.input.ide # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "{{ auto_populated_field|camel_case }}": - assert _UUID4_RE.match(value) + assert re.fullmatch(r"{{ get_uuid4_re() }}", value) break # Include {{ auto_populated_field|camel_case }} within expected_params with value mock.ANY @@ -1556,20 +1572,21 @@ def test_{{ method_name }}_rest_no_http_options(): # Establish that the underlying stub method was called. call.assert_called() _, args, {% if routing_param %}kw{% else %}_{% endif %} = call.mock_calls[0] - {% if request_dict %} - request_msg = {{ method.input.ident }}(**{{ request_dict }}) - {% else %} - request_msg = {{ method.input.ident }}() - {% endif %}{# request_dict #} {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].{{ auto_populated_field }}) - request_msg.{{ auto_populated_field }} = args[0].{{ auto_populated_field }} + assert re.fullmatch(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None {% endfor %}{# for auto_populated_field in method_settings.auto_populated_fields #} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} + {% if request_dict %} + request_msg = {{ method.input.ident }}(**{{ request_dict }}) + {% else %} + request_msg = {{ method.input.ident }}() + {% endif %}{# request_dict #} assert args[0] == request_msg {% if routing_param %} @@ -2196,7 +2213,7 @@ def test_initialize_client_w_{{transport_name}}(): {% endmacro %}{# empty_call_test #} {% macro get_uuid4_re() -%} -{{ uuid4_re }} +[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12} {%- endmacro %}{# uuid_re #} {% macro routing_parameter_test(service, api, transport, is_async) %} diff --git a/packages/gapic-generator/gapic/utils/__init__.py b/packages/gapic-generator/gapic/utils/__init__.py index 18d78c31dd1e..23c573915695 100644 --- a/packages/gapic-generator/gapic/utils/__init__.py +++ b/packages/gapic-generator/gapic/utils/__init__.py @@ -22,7 +22,6 @@ from gapic.utils.code import nth from gapic.utils.code import partition from gapic.utils.code import make_private -from gapic.utils.constants import UUID4_RE from gapic.utils.doc import doc from gapic.utils.filename import to_valid_filename from gapic.utils.filename import to_valid_module_name @@ -53,6 +52,5 @@ "to_camel_case", "to_valid_filename", "to_valid_module_name", - "UUID4_RE", "wrap", ) diff --git a/packages/gapic-generator/setup.py b/packages/gapic-generator/setup.py index 41c08ae8a4a9..3e9afad5fefe 100644 --- a/packages/gapic-generator/setup.py +++ b/packages/gapic-generator/setup.py @@ -21,7 +21,7 @@ name = "gapic-generator" description = "Google API Client Generator for Python" -url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/gapic-generator" +url = "https://github.com/googleapis/gapic-generator-python" version = "1.33.0" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ diff --git a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py index 83641272747f..98a41f32aec8 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -965,10 +965,8 @@ def test_asset_service_client_create_channel_credentials_file(client_class, tran @pytest.mark.parametrize("request_type", [ - asset_service.ExportAssetsRequest({ - }), - { - }, + asset_service.ExportAssetsRequest, + dict, ]) def test_export_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -978,7 +976,7 @@ def test_export_assets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1021,10 +1019,9 @@ def test_export_assets_non_empty_request_with_auto_populated_field(): client.export_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.ExportAssetsRequest( + assert args[0] == asset_service.ExportAssetsRequest( parent='parent_value', ) - assert args[0] == request_msg def test_export_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1103,11 +1100,7 @@ async def test_export_assets_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.ExportAssetsRequest({ }), - { }, -]) -async def test_export_assets_async(request_type, transport: str = 'grpc_asyncio'): +async def test_export_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.ExportAssetsRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1115,7 +1108,7 @@ async def test_export_assets_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1136,6 +1129,11 @@ async def test_export_assets_async(request_type, transport: str = 'grpc_asyncio' # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_export_assets_async_from_dict(): + await test_export_assets_async(request_type=dict) + def test_export_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1200,10 +1198,8 @@ async def test_export_assets_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.ListAssetsRequest({ - }), - { - }, + asset_service.ListAssetsRequest, + dict, ]) def test_list_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -1213,7 +1209,7 @@ def test_list_assets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1260,11 +1256,10 @@ def test_list_assets_non_empty_request_with_auto_populated_field(): client.list_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.ListAssetsRequest( + assert args[0] == asset_service.ListAssetsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1333,11 +1328,7 @@ async def test_list_assets_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.ListAssetsRequest({ }), - { }, -]) -async def test_list_assets_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListAssetsRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1345,7 +1336,7 @@ async def test_list_assets_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1367,6 +1358,11 @@ async def test_list_assets_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListAssetsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_assets_async_from_dict(): + await test_list_assets_async(request_type=dict) + def test_list_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1707,10 +1703,8 @@ async def test_list_assets_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.BatchGetAssetsHistoryRequest({ - }), - { - }, + asset_service.BatchGetAssetsHistoryRequest, + dict, ]) def test_batch_get_assets_history(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -1720,7 +1714,7 @@ def test_batch_get_assets_history(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1764,10 +1758,9 @@ def test_batch_get_assets_history_non_empty_request_with_auto_populated_field(): client.batch_get_assets_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.BatchGetAssetsHistoryRequest( + assert args[0] == asset_service.BatchGetAssetsHistoryRequest( parent='parent_value', ) - assert args[0] == request_msg def test_batch_get_assets_history_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1836,11 +1829,7 @@ async def test_batch_get_assets_history_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.BatchGetAssetsHistoryRequest({ }), - { }, -]) -async def test_batch_get_assets_history_async(request_type, transport: str = 'grpc_asyncio'): +async def test_batch_get_assets_history_async(transport: str = 'grpc_asyncio', request_type=asset_service.BatchGetAssetsHistoryRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1848,7 +1837,7 @@ async def test_batch_get_assets_history_async(request_type, transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1868,6 +1857,11 @@ async def test_batch_get_assets_history_async(request_type, transport: str = 'gr # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetAssetsHistoryResponse) + +@pytest.mark.asyncio +async def test_batch_get_assets_history_async_from_dict(): + await test_batch_get_assets_history_async(request_type=dict) + def test_batch_get_assets_history_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1932,10 +1926,8 @@ async def test_batch_get_assets_history_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.CreateFeedRequest({ - }), - { - }, + asset_service.CreateFeedRequest, + dict, ]) def test_create_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -1945,7 +1937,7 @@ def test_create_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2000,11 +1992,10 @@ def test_create_feed_non_empty_request_with_auto_populated_field(): client.create_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.CreateFeedRequest( + assert args[0] == asset_service.CreateFeedRequest( parent='parent_value', feed_id='feed_id_value', ) - assert args[0] == request_msg def test_create_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2073,11 +2064,7 @@ async def test_create_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.CreateFeedRequest({ }), - { }, -]) -async def test_create_feed_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.CreateFeedRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2085,7 +2072,7 @@ async def test_create_feed_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2115,6 +2102,11 @@ async def test_create_feed_async(request_type, transport: str = 'grpc_asyncio'): assert response.content_type == asset_service.ContentType.RESOURCE assert response.relationship_types == ['relationship_types_value'] + +@pytest.mark.asyncio +async def test_create_feed_async_from_dict(): + await test_create_feed_async(request_type=dict) + def test_create_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2261,10 +2253,8 @@ async def test_create_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.GetFeedRequest({ - }), - { - }, + asset_service.GetFeedRequest, + dict, ]) def test_get_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -2274,7 +2264,7 @@ def test_get_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2328,10 +2318,9 @@ def test_get_feed_non_empty_request_with_auto_populated_field(): client.get_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.GetFeedRequest( + assert args[0] == asset_service.GetFeedRequest( name='name_value', ) - assert args[0] == request_msg def test_get_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2400,11 +2389,7 @@ async def test_get_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.GetFeedRequest({ }), - { }, -]) -async def test_get_feed_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.GetFeedRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2412,7 +2397,7 @@ async def test_get_feed_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2442,6 +2427,11 @@ async def test_get_feed_async(request_type, transport: str = 'grpc_asyncio'): assert response.content_type == asset_service.ContentType.RESOURCE assert response.relationship_types == ['relationship_types_value'] + +@pytest.mark.asyncio +async def test_get_feed_async_from_dict(): + await test_get_feed_async(request_type=dict) + def test_get_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2588,10 +2578,8 @@ async def test_get_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.ListFeedsRequest({ - }), - { - }, + asset_service.ListFeedsRequest, + dict, ]) def test_list_feeds(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -2601,7 +2589,7 @@ def test_list_feeds(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2645,10 +2633,9 @@ def test_list_feeds_non_empty_request_with_auto_populated_field(): client.list_feeds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.ListFeedsRequest( + assert args[0] == asset_service.ListFeedsRequest( parent='parent_value', ) - assert args[0] == request_msg def test_list_feeds_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2717,11 +2704,7 @@ async def test_list_feeds_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.ListFeedsRequest({ }), - { }, -]) -async def test_list_feeds_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_feeds_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListFeedsRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2729,7 +2712,7 @@ async def test_list_feeds_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2749,6 +2732,11 @@ async def test_list_feeds_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert isinstance(response, asset_service.ListFeedsResponse) + +@pytest.mark.asyncio +async def test_list_feeds_async_from_dict(): + await test_list_feeds_async(request_type=dict) + def test_list_feeds_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2895,10 +2883,8 @@ async def test_list_feeds_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.UpdateFeedRequest({ - }), - { - }, + asset_service.UpdateFeedRequest, + dict, ]) def test_update_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -2908,7 +2894,7 @@ def test_update_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2961,9 +2947,8 @@ def test_update_feed_non_empty_request_with_auto_populated_field(): client.update_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.UpdateFeedRequest( + assert args[0] == asset_service.UpdateFeedRequest( ) - assert args[0] == request_msg def test_update_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3032,11 +3017,7 @@ async def test_update_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.UpdateFeedRequest({ }), - { }, -]) -async def test_update_feed_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.UpdateFeedRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3044,7 +3025,7 @@ async def test_update_feed_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3074,6 +3055,11 @@ async def test_update_feed_async(request_type, transport: str = 'grpc_asyncio'): assert response.content_type == asset_service.ContentType.RESOURCE assert response.relationship_types == ['relationship_types_value'] + +@pytest.mark.asyncio +async def test_update_feed_async_from_dict(): + await test_update_feed_async(request_type=dict) + def test_update_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3220,10 +3206,8 @@ async def test_update_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.DeleteFeedRequest({ - }), - { - }, + asset_service.DeleteFeedRequest, + dict, ]) def test_delete_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -3233,7 +3217,7 @@ def test_delete_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3276,10 +3260,9 @@ def test_delete_feed_non_empty_request_with_auto_populated_field(): client.delete_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.DeleteFeedRequest( + assert args[0] == asset_service.DeleteFeedRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3348,11 +3331,7 @@ async def test_delete_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.DeleteFeedRequest({ }), - { }, -]) -async def test_delete_feed_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.DeleteFeedRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3360,7 +3339,7 @@ async def test_delete_feed_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3379,6 +3358,11 @@ async def test_delete_feed_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_feed_async_from_dict(): + await test_delete_feed_async(request_type=dict) + def test_delete_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,10 +3509,8 @@ async def test_delete_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.SearchAllResourcesRequest({ - }), - { - }, + asset_service.SearchAllResourcesRequest, + dict, ]) def test_search_all_resources(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -3538,7 +3520,7 @@ def test_search_all_resources(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3587,13 +3569,12 @@ def test_search_all_resources_non_empty_request_with_auto_populated_field(): client.search_all_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.SearchAllResourcesRequest( + assert args[0] == asset_service.SearchAllResourcesRequest( scope='scope_value', query='query_value', page_token='page_token_value', order_by='order_by_value', ) - assert args[0] == request_msg def test_search_all_resources_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3662,11 +3643,7 @@ async def test_search_all_resources_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.SearchAllResourcesRequest({ }), - { }, -]) -async def test_search_all_resources_async(request_type, transport: str = 'grpc_asyncio'): +async def test_search_all_resources_async(transport: str = 'grpc_asyncio', request_type=asset_service.SearchAllResourcesRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3674,7 +3651,7 @@ async def test_search_all_resources_async(request_type, transport: str = 'grpc_a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3696,6 +3673,11 @@ async def test_search_all_resources_async(request_type, transport: str = 'grpc_a assert isinstance(response, pagers.SearchAllResourcesAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_search_all_resources_async_from_dict(): + await test_search_all_resources_async(request_type=dict) + def test_search_all_resources_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4056,10 +4038,8 @@ async def test_search_all_resources_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.SearchAllIamPoliciesRequest({ - }), - { - }, + asset_service.SearchAllIamPoliciesRequest, + dict, ]) def test_search_all_iam_policies(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -4069,7 +4049,7 @@ def test_search_all_iam_policies(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4118,13 +4098,12 @@ def test_search_all_iam_policies_non_empty_request_with_auto_populated_field(): client.search_all_iam_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.SearchAllIamPoliciesRequest( + assert args[0] == asset_service.SearchAllIamPoliciesRequest( scope='scope_value', query='query_value', page_token='page_token_value', order_by='order_by_value', ) - assert args[0] == request_msg def test_search_all_iam_policies_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4193,11 +4172,7 @@ async def test_search_all_iam_policies_async_use_cached_wrapped_rpc(transport: s assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.SearchAllIamPoliciesRequest({ }), - { }, -]) -async def test_search_all_iam_policies_async(request_type, transport: str = 'grpc_asyncio'): +async def test_search_all_iam_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.SearchAllIamPoliciesRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4205,7 +4180,7 @@ async def test_search_all_iam_policies_async(request_type, transport: str = 'grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4227,6 +4202,11 @@ async def test_search_all_iam_policies_async(request_type, transport: str = 'grp assert isinstance(response, pagers.SearchAllIamPoliciesAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_search_all_iam_policies_async_from_dict(): + await test_search_all_iam_policies_async(request_type=dict) + def test_search_all_iam_policies_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4577,10 +4557,8 @@ async def test_search_all_iam_policies_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeIamPolicyRequest({ - }), - { - }, + asset_service.AnalyzeIamPolicyRequest, + dict, ]) def test_analyze_iam_policy(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -4590,7 +4568,7 @@ def test_analyze_iam_policy(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4636,10 +4614,9 @@ def test_analyze_iam_policy_non_empty_request_with_auto_populated_field(): client.analyze_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.AnalyzeIamPolicyRequest( + assert args[0] == asset_service.AnalyzeIamPolicyRequest( saved_analysis_query='saved_analysis_query_value', ) - assert args[0] == request_msg def test_analyze_iam_policy_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4708,11 +4685,7 @@ async def test_analyze_iam_policy_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeIamPolicyRequest({ }), - { }, -]) -async def test_analyze_iam_policy_async(request_type, transport: str = 'grpc_asyncio'): +async def test_analyze_iam_policy_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeIamPolicyRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4720,7 +4693,7 @@ async def test_analyze_iam_policy_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4742,6 +4715,11 @@ async def test_analyze_iam_policy_async(request_type, transport: str = 'grpc_asy assert isinstance(response, asset_service.AnalyzeIamPolicyResponse) assert response.fully_explored is True + +@pytest.mark.asyncio +async def test_analyze_iam_policy_async_from_dict(): + await test_analyze_iam_policy_async(request_type=dict) + def test_analyze_iam_policy_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4806,10 +4784,8 @@ async def test_analyze_iam_policy_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeIamPolicyLongrunningRequest({ - }), - { - }, + asset_service.AnalyzeIamPolicyLongrunningRequest, + dict, ]) def test_analyze_iam_policy_longrunning(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -4819,7 +4795,7 @@ def test_analyze_iam_policy_longrunning(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4862,10 +4838,9 @@ def test_analyze_iam_policy_longrunning_non_empty_request_with_auto_populated_fi client.analyze_iam_policy_longrunning(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest( + assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest( saved_analysis_query='saved_analysis_query_value', ) - assert args[0] == request_msg def test_analyze_iam_policy_longrunning_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4944,11 +4919,7 @@ async def test_analyze_iam_policy_longrunning_async_use_cached_wrapped_rpc(trans assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeIamPolicyLongrunningRequest({ }), - { }, -]) -async def test_analyze_iam_policy_longrunning_async(request_type, transport: str = 'grpc_asyncio'): +async def test_analyze_iam_policy_longrunning_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeIamPolicyLongrunningRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4956,7 +4927,7 @@ async def test_analyze_iam_policy_longrunning_async(request_type, transport: str # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4977,6 +4948,11 @@ async def test_analyze_iam_policy_longrunning_async(request_type, transport: str # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_analyze_iam_policy_longrunning_async_from_dict(): + await test_analyze_iam_policy_longrunning_async(request_type=dict) + def test_analyze_iam_policy_longrunning_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5041,10 +5017,8 @@ async def test_analyze_iam_policy_longrunning_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeMoveRequest({ - }), - { - }, + asset_service.AnalyzeMoveRequest, + dict, ]) def test_analyze_move(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5054,7 +5028,7 @@ def test_analyze_move(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5099,11 +5073,10 @@ def test_analyze_move_non_empty_request_with_auto_populated_field(): client.analyze_move(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.AnalyzeMoveRequest( + assert args[0] == asset_service.AnalyzeMoveRequest( resource='resource_value', destination_parent='destination_parent_value', ) - assert args[0] == request_msg def test_analyze_move_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5172,11 +5145,7 @@ async def test_analyze_move_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeMoveRequest({ }), - { }, -]) -async def test_analyze_move_async(request_type, transport: str = 'grpc_asyncio'): +async def test_analyze_move_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeMoveRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5184,7 +5153,7 @@ async def test_analyze_move_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5204,6 +5173,11 @@ async def test_analyze_move_async(request_type, transport: str = 'grpc_asyncio') # Establish that the response is the type that we expect. assert isinstance(response, asset_service.AnalyzeMoveResponse) + +@pytest.mark.asyncio +async def test_analyze_move_async_from_dict(): + await test_analyze_move_async(request_type=dict) + def test_analyze_move_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5268,10 +5242,8 @@ async def test_analyze_move_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.QueryAssetsRequest({ - }), - { - }, + asset_service.QueryAssetsRequest, + dict, ]) def test_query_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5281,7 +5253,7 @@ def test_query_assets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5332,13 +5304,12 @@ def test_query_assets_non_empty_request_with_auto_populated_field(): client.query_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.QueryAssetsRequest( + assert args[0] == asset_service.QueryAssetsRequest( parent='parent_value', statement='statement_value', job_reference='job_reference_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_query_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5407,11 +5378,7 @@ async def test_query_assets_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.QueryAssetsRequest({ }), - { }, -]) -async def test_query_assets_async(request_type, transport: str = 'grpc_asyncio'): +async def test_query_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.QueryAssetsRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5419,7 +5386,7 @@ async def test_query_assets_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5443,6 +5410,11 @@ async def test_query_assets_async(request_type, transport: str = 'grpc_asyncio') assert response.job_reference == 'job_reference_value' assert response.done is True + +@pytest.mark.asyncio +async def test_query_assets_async_from_dict(): + await test_query_assets_async(request_type=dict) + def test_query_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5507,10 +5479,8 @@ async def test_query_assets_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.CreateSavedQueryRequest({ - }), - { - }, + asset_service.CreateSavedQueryRequest, + dict, ]) def test_create_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5520,7 +5490,7 @@ def test_create_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5573,11 +5543,10 @@ def test_create_saved_query_non_empty_request_with_auto_populated_field(): client.create_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.CreateSavedQueryRequest( + assert args[0] == asset_service.CreateSavedQueryRequest( parent='parent_value', saved_query_id='saved_query_id_value', ) - assert args[0] == request_msg def test_create_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5646,11 +5615,7 @@ async def test_create_saved_query_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.CreateSavedQueryRequest({ }), - { }, -]) -async def test_create_saved_query_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.CreateSavedQueryRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5658,7 +5623,7 @@ async def test_create_saved_query_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5686,6 +5651,11 @@ async def test_create_saved_query_async(request_type, transport: str = 'grpc_asy assert response.creator == 'creator_value' assert response.last_updater == 'last_updater_value' + +@pytest.mark.asyncio +async def test_create_saved_query_async_from_dict(): + await test_create_saved_query_async(request_type=dict) + def test_create_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5852,10 +5822,8 @@ async def test_create_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.GetSavedQueryRequest({ - }), - { - }, + asset_service.GetSavedQueryRequest, + dict, ]) def test_get_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5865,7 +5833,7 @@ def test_get_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5917,10 +5885,9 @@ def test_get_saved_query_non_empty_request_with_auto_populated_field(): client.get_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.GetSavedQueryRequest( + assert args[0] == asset_service.GetSavedQueryRequest( name='name_value', ) - assert args[0] == request_msg def test_get_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5989,11 +5956,7 @@ async def test_get_saved_query_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.GetSavedQueryRequest({ }), - { }, -]) -async def test_get_saved_query_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.GetSavedQueryRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6001,7 +5964,7 @@ async def test_get_saved_query_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6029,6 +5992,11 @@ async def test_get_saved_query_async(request_type, transport: str = 'grpc_asynci assert response.creator == 'creator_value' assert response.last_updater == 'last_updater_value' + +@pytest.mark.asyncio +async def test_get_saved_query_async_from_dict(): + await test_get_saved_query_async(request_type=dict) + def test_get_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6175,10 +6143,8 @@ async def test_get_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.ListSavedQueriesRequest({ - }), - { - }, + asset_service.ListSavedQueriesRequest, + dict, ]) def test_list_saved_queries(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -6188,7 +6154,7 @@ def test_list_saved_queries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6236,12 +6202,11 @@ def test_list_saved_queries_non_empty_request_with_auto_populated_field(): client.list_saved_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.ListSavedQueriesRequest( + assert args[0] == asset_service.ListSavedQueriesRequest( parent='parent_value', filter='filter_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_saved_queries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6310,11 +6275,7 @@ async def test_list_saved_queries_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.ListSavedQueriesRequest({ }), - { }, -]) -async def test_list_saved_queries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_saved_queries_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListSavedQueriesRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6322,7 +6283,7 @@ async def test_list_saved_queries_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6344,6 +6305,11 @@ async def test_list_saved_queries_async(request_type, transport: str = 'grpc_asy assert isinstance(response, pagers.ListSavedQueriesAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_saved_queries_async_from_dict(): + await test_list_saved_queries_async(request_type=dict) + def test_list_saved_queries_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6684,10 +6650,8 @@ async def test_list_saved_queries_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.UpdateSavedQueryRequest({ - }), - { - }, + asset_service.UpdateSavedQueryRequest, + dict, ]) def test_update_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -6697,7 +6661,7 @@ def test_update_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6748,9 +6712,8 @@ def test_update_saved_query_non_empty_request_with_auto_populated_field(): client.update_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.UpdateSavedQueryRequest( + assert args[0] == asset_service.UpdateSavedQueryRequest( ) - assert args[0] == request_msg def test_update_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6819,11 +6782,7 @@ async def test_update_saved_query_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.UpdateSavedQueryRequest({ }), - { }, -]) -async def test_update_saved_query_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.UpdateSavedQueryRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6831,7 +6790,7 @@ async def test_update_saved_query_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6859,6 +6818,11 @@ async def test_update_saved_query_async(request_type, transport: str = 'grpc_asy assert response.creator == 'creator_value' assert response.last_updater == 'last_updater_value' + +@pytest.mark.asyncio +async def test_update_saved_query_async_from_dict(): + await test_update_saved_query_async(request_type=dict) + def test_update_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7015,10 +6979,8 @@ async def test_update_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.DeleteSavedQueryRequest({ - }), - { - }, + asset_service.DeleteSavedQueryRequest, + dict, ]) def test_delete_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -7028,7 +6990,7 @@ def test_delete_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7071,10 +7033,9 @@ def test_delete_saved_query_non_empty_request_with_auto_populated_field(): client.delete_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.DeleteSavedQueryRequest( + assert args[0] == asset_service.DeleteSavedQueryRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7143,11 +7104,7 @@ async def test_delete_saved_query_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.DeleteSavedQueryRequest({ }), - { }, -]) -async def test_delete_saved_query_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.DeleteSavedQueryRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7155,7 +7112,7 @@ async def test_delete_saved_query_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7174,6 +7131,11 @@ async def test_delete_saved_query_async(request_type, transport: str = 'grpc_asy # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_saved_query_async_from_dict(): + await test_delete_saved_query_async(request_type=dict) + def test_delete_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7320,10 +7282,8 @@ async def test_delete_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.BatchGetEffectiveIamPoliciesRequest({ - }), - { - }, + asset_service.BatchGetEffectiveIamPoliciesRequest, + dict, ]) def test_batch_get_effective_iam_policies(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -7333,7 +7293,7 @@ def test_batch_get_effective_iam_policies(request_type, transport: str = 'grpc') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7377,10 +7337,9 @@ def test_batch_get_effective_iam_policies_non_empty_request_with_auto_populated_ client.batch_get_effective_iam_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest( + assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest( scope='scope_value', ) - assert args[0] == request_msg def test_batch_get_effective_iam_policies_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7449,11 +7408,7 @@ async def test_batch_get_effective_iam_policies_async_use_cached_wrapped_rpc(tra assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.BatchGetEffectiveIamPoliciesRequest({ }), - { }, -]) -async def test_batch_get_effective_iam_policies_async(request_type, transport: str = 'grpc_asyncio'): +async def test_batch_get_effective_iam_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.BatchGetEffectiveIamPoliciesRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7461,7 +7416,7 @@ async def test_batch_get_effective_iam_policies_async(request_type, transport: s # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7481,6 +7436,11 @@ async def test_batch_get_effective_iam_policies_async(request_type, transport: s # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetEffectiveIamPoliciesResponse) + +@pytest.mark.asyncio +async def test_batch_get_effective_iam_policies_async_from_dict(): + await test_batch_get_effective_iam_policies_async(request_type=dict) + def test_batch_get_effective_iam_policies_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7545,10 +7505,8 @@ async def test_batch_get_effective_iam_policies_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPoliciesRequest({ - }), - { - }, + asset_service.AnalyzeOrgPoliciesRequest, + dict, ]) def test_analyze_org_policies(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -7558,7 +7516,7 @@ def test_analyze_org_policies(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7607,13 +7565,12 @@ def test_analyze_org_policies_non_empty_request_with_auto_populated_field(): client.analyze_org_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.AnalyzeOrgPoliciesRequest( + assert args[0] == asset_service.AnalyzeOrgPoliciesRequest( scope='scope_value', constraint='constraint_value', filter='filter_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_analyze_org_policies_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7682,11 +7639,7 @@ async def test_analyze_org_policies_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPoliciesRequest({ }), - { }, -]) -async def test_analyze_org_policies_async(request_type, transport: str = 'grpc_asyncio'): +async def test_analyze_org_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPoliciesRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7694,7 +7647,7 @@ async def test_analyze_org_policies_async(request_type, transport: str = 'grpc_a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7716,6 +7669,11 @@ async def test_analyze_org_policies_async(request_type, transport: str = 'grpc_a assert isinstance(response, pagers.AnalyzeOrgPoliciesAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_analyze_org_policies_async_from_dict(): + await test_analyze_org_policies_async(request_type=dict) + def test_analyze_org_policies_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8076,10 +8034,8 @@ async def test_analyze_org_policies_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPolicyGovernedContainersRequest({ - }), - { - }, + asset_service.AnalyzeOrgPolicyGovernedContainersRequest, + dict, ]) def test_analyze_org_policy_governed_containers(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -8089,7 +8045,7 @@ def test_analyze_org_policy_governed_containers(request_type, transport: str = ' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8138,13 +8094,12 @@ def test_analyze_org_policy_governed_containers_non_empty_request_with_auto_popu client.analyze_org_policy_governed_containers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest( + assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest( scope='scope_value', constraint='constraint_value', filter='filter_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_analyze_org_policy_governed_containers_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8213,11 +8168,7 @@ async def test_analyze_org_policy_governed_containers_async_use_cached_wrapped_r assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPolicyGovernedContainersRequest({ }), - { }, -]) -async def test_analyze_org_policy_governed_containers_async(request_type, transport: str = 'grpc_asyncio'): +async def test_analyze_org_policy_governed_containers_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPolicyGovernedContainersRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8225,7 +8176,7 @@ async def test_analyze_org_policy_governed_containers_async(request_type, transp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8247,6 +8198,11 @@ async def test_analyze_org_policy_governed_containers_async(request_type, transp assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedContainersAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_analyze_org_policy_governed_containers_async_from_dict(): + await test_analyze_org_policy_governed_containers_async(request_type=dict) + def test_analyze_org_policy_governed_containers_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8607,10 +8563,8 @@ async def test_analyze_org_policy_governed_containers_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPolicyGovernedAssetsRequest({ - }), - { - }, + asset_service.AnalyzeOrgPolicyGovernedAssetsRequest, + dict, ]) def test_analyze_org_policy_governed_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -8620,7 +8574,7 @@ def test_analyze_org_policy_governed_assets(request_type, transport: str = 'grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8669,13 +8623,12 @@ def test_analyze_org_policy_governed_assets_non_empty_request_with_auto_populate client.analyze_org_policy_governed_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( + assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( scope='scope_value', constraint='constraint_value', filter='filter_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_analyze_org_policy_governed_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8744,11 +8697,7 @@ async def test_analyze_org_policy_governed_assets_async_use_cached_wrapped_rpc(t assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPolicyGovernedAssetsRequest({ }), - { }, -]) -async def test_analyze_org_policy_governed_assets_async(request_type, transport: str = 'grpc_asyncio'): +async def test_analyze_org_policy_governed_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPolicyGovernedAssetsRequest): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8756,7 +8705,7 @@ async def test_analyze_org_policy_governed_assets_async(request_type, transport: # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8778,6 +8727,11 @@ async def test_analyze_org_policy_governed_assets_async(request_type, transport: assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedAssetsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_analyze_org_policy_governed_assets_async_from_dict(): + await test_analyze_org_policy_governed_assets_async(request_type=dict) + def test_analyze_org_policy_governed_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13232,6 +13186,7 @@ def test_export_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() + assert args[0] == request_msg @@ -13254,6 +13209,7 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() + assert args[0] == request_msg @@ -13276,6 +13232,7 @@ def test_batch_get_assets_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() + assert args[0] == request_msg @@ -13298,6 +13255,7 @@ def test_create_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() + assert args[0] == request_msg @@ -13320,6 +13278,7 @@ def test_get_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() + assert args[0] == request_msg @@ -13342,6 +13301,7 @@ def test_list_feeds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() + assert args[0] == request_msg @@ -13364,6 +13324,7 @@ def test_update_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() + assert args[0] == request_msg @@ -13386,6 +13347,7 @@ def test_delete_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() + assert args[0] == request_msg @@ -13408,6 +13370,7 @@ def test_search_all_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() + assert args[0] == request_msg @@ -13430,6 +13393,7 @@ def test_search_all_iam_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() + assert args[0] == request_msg @@ -13452,6 +13416,7 @@ def test_analyze_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() + assert args[0] == request_msg @@ -13474,6 +13439,7 @@ def test_analyze_iam_policy_longrunning_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() + assert args[0] == request_msg @@ -13496,6 +13462,7 @@ def test_analyze_move_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() + assert args[0] == request_msg @@ -13518,6 +13485,7 @@ def test_query_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() + assert args[0] == request_msg @@ -13540,6 +13508,7 @@ def test_create_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() + assert args[0] == request_msg @@ -13562,6 +13531,7 @@ def test_get_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() + assert args[0] == request_msg @@ -13584,6 +13554,7 @@ def test_list_saved_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() + assert args[0] == request_msg @@ -13606,6 +13577,7 @@ def test_update_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() + assert args[0] == request_msg @@ -13628,6 +13600,7 @@ def test_delete_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() + assert args[0] == request_msg @@ -13650,6 +13623,7 @@ def test_batch_get_effective_iam_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() + assert args[0] == request_msg @@ -13672,6 +13646,7 @@ def test_analyze_org_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() + assert args[0] == request_msg @@ -13694,6 +13669,7 @@ def test_analyze_org_policy_governed_containers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + assert args[0] == request_msg @@ -13716,6 +13692,7 @@ def test_analyze_org_policy_governed_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + assert args[0] == request_msg @@ -13757,6 +13734,7 @@ async def test_export_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() + assert args[0] == request_msg @@ -13783,6 +13761,7 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() + assert args[0] == request_msg @@ -13808,6 +13787,7 @@ async def test_batch_get_assets_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() + assert args[0] == request_msg @@ -13838,6 +13818,7 @@ async def test_create_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() + assert args[0] == request_msg @@ -13868,6 +13849,7 @@ async def test_get_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() + assert args[0] == request_msg @@ -13893,6 +13875,7 @@ async def test_list_feeds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() + assert args[0] == request_msg @@ -13923,6 +13906,7 @@ async def test_update_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() + assert args[0] == request_msg @@ -13947,6 +13931,7 @@ async def test_delete_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() + assert args[0] == request_msg @@ -13973,6 +13958,7 @@ async def test_search_all_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() + assert args[0] == request_msg @@ -13999,6 +13985,7 @@ async def test_search_all_iam_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() + assert args[0] == request_msg @@ -14025,6 +14012,7 @@ async def test_analyze_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() + assert args[0] == request_msg @@ -14051,6 +14039,7 @@ async def test_analyze_iam_policy_longrunning_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() + assert args[0] == request_msg @@ -14076,6 +14065,7 @@ async def test_analyze_move_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() + assert args[0] == request_msg @@ -14103,6 +14093,7 @@ async def test_query_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() + assert args[0] == request_msg @@ -14132,6 +14123,7 @@ async def test_create_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() + assert args[0] == request_msg @@ -14161,6 +14153,7 @@ async def test_get_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() + assert args[0] == request_msg @@ -14187,6 +14180,7 @@ async def test_list_saved_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() + assert args[0] == request_msg @@ -14216,6 +14210,7 @@ async def test_update_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() + assert args[0] == request_msg @@ -14240,6 +14235,7 @@ async def test_delete_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() + assert args[0] == request_msg @@ -14265,6 +14261,7 @@ async def test_batch_get_effective_iam_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() + assert args[0] == request_msg @@ -14291,6 +14288,7 @@ async def test_analyze_org_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() + assert args[0] == request_msg @@ -14317,6 +14315,7 @@ async def test_analyze_org_policy_governed_containers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + assert args[0] == request_msg @@ -14343,6 +14342,7 @@ async def test_analyze_org_policy_governed_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + assert args[0] == request_msg @@ -16991,6 +16991,7 @@ def test_export_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() + assert args[0] == request_msg @@ -17012,6 +17013,7 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() + assert args[0] == request_msg @@ -17033,6 +17035,7 @@ def test_batch_get_assets_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() + assert args[0] == request_msg @@ -17054,6 +17057,7 @@ def test_create_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() + assert args[0] == request_msg @@ -17075,6 +17079,7 @@ def test_get_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() + assert args[0] == request_msg @@ -17096,6 +17101,7 @@ def test_list_feeds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() + assert args[0] == request_msg @@ -17117,6 +17123,7 @@ def test_update_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() + assert args[0] == request_msg @@ -17138,6 +17145,7 @@ def test_delete_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() + assert args[0] == request_msg @@ -17159,6 +17167,7 @@ def test_search_all_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() + assert args[0] == request_msg @@ -17180,6 +17189,7 @@ def test_search_all_iam_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() + assert args[0] == request_msg @@ -17201,6 +17211,7 @@ def test_analyze_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() + assert args[0] == request_msg @@ -17222,6 +17233,7 @@ def test_analyze_iam_policy_longrunning_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() + assert args[0] == request_msg @@ -17243,6 +17255,7 @@ def test_analyze_move_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() + assert args[0] == request_msg @@ -17264,6 +17277,7 @@ def test_query_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() + assert args[0] == request_msg @@ -17285,6 +17299,7 @@ def test_create_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() + assert args[0] == request_msg @@ -17306,6 +17321,7 @@ def test_get_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() + assert args[0] == request_msg @@ -17327,6 +17343,7 @@ def test_list_saved_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() + assert args[0] == request_msg @@ -17348,6 +17365,7 @@ def test_update_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() + assert args[0] == request_msg @@ -17369,6 +17387,7 @@ def test_delete_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() + assert args[0] == request_msg @@ -17390,6 +17409,7 @@ def test_batch_get_effective_iam_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() + assert args[0] == request_msg @@ -17411,6 +17431,7 @@ def test_analyze_org_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() + assert args[0] == request_msg @@ -17432,6 +17453,7 @@ def test_analyze_org_policy_governed_containers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + assert args[0] == request_msg @@ -17453,6 +17475,7 @@ def test_analyze_org_policy_governed_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py index 6c0f3aea78a5..74fa9dbfb423 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py @@ -955,10 +955,8 @@ def test_iam_credentials_client_create_channel_credentials_file(client_class, tr @pytest.mark.parametrize("request_type", [ - common.GenerateAccessTokenRequest({ - }), - { - }, + common.GenerateAccessTokenRequest, + dict, ]) def test_generate_access_token(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -968,7 +966,7 @@ def test_generate_access_token(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1014,10 +1012,9 @@ def test_generate_access_token_non_empty_request_with_auto_populated_field(): client.generate_access_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = common.GenerateAccessTokenRequest( + assert args[0] == common.GenerateAccessTokenRequest( name='name_value', ) - assert args[0] == request_msg def test_generate_access_token_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1086,11 +1083,7 @@ async def test_generate_access_token_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - common.GenerateAccessTokenRequest({ }), - { }, -]) -async def test_generate_access_token_async(request_type, transport: str = 'grpc_asyncio'): +async def test_generate_access_token_async(transport: str = 'grpc_asyncio', request_type=common.GenerateAccessTokenRequest): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1098,7 +1091,7 @@ async def test_generate_access_token_async(request_type, transport: str = 'grpc_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1120,6 +1113,11 @@ async def test_generate_access_token_async(request_type, transport: str = 'grpc_ assert isinstance(response, common.GenerateAccessTokenResponse) assert response.access_token == 'access_token_value' + +@pytest.mark.asyncio +async def test_generate_access_token_async_from_dict(): + await test_generate_access_token_async(request_type=dict) + def test_generate_access_token_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1292,10 +1290,8 @@ async def test_generate_access_token_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - common.GenerateIdTokenRequest({ - }), - { - }, + common.GenerateIdTokenRequest, + dict, ]) def test_generate_id_token(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -1305,7 +1301,7 @@ def test_generate_id_token(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1352,11 +1348,10 @@ def test_generate_id_token_non_empty_request_with_auto_populated_field(): client.generate_id_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = common.GenerateIdTokenRequest( + assert args[0] == common.GenerateIdTokenRequest( name='name_value', audience='audience_value', ) - assert args[0] == request_msg def test_generate_id_token_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1425,11 +1420,7 @@ async def test_generate_id_token_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - common.GenerateIdTokenRequest({ }), - { }, -]) -async def test_generate_id_token_async(request_type, transport: str = 'grpc_asyncio'): +async def test_generate_id_token_async(transport: str = 'grpc_asyncio', request_type=common.GenerateIdTokenRequest): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1437,7 +1428,7 @@ async def test_generate_id_token_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1459,6 +1450,11 @@ async def test_generate_id_token_async(request_type, transport: str = 'grpc_asyn assert isinstance(response, common.GenerateIdTokenResponse) assert response.token == 'token_value' + +@pytest.mark.asyncio +async def test_generate_id_token_async_from_dict(): + await test_generate_id_token_async(request_type=dict) + def test_generate_id_token_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1635,10 +1631,8 @@ async def test_generate_id_token_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - common.SignBlobRequest({ - }), - { - }, + common.SignBlobRequest, + dict, ]) def test_sign_blob(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -1648,7 +1642,7 @@ def test_sign_blob(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1696,10 +1690,9 @@ def test_sign_blob_non_empty_request_with_auto_populated_field(): client.sign_blob(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = common.SignBlobRequest( + assert args[0] == common.SignBlobRequest( name='name_value', ) - assert args[0] == request_msg def test_sign_blob_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1768,11 +1761,7 @@ async def test_sign_blob_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - common.SignBlobRequest({ }), - { }, -]) -async def test_sign_blob_async(request_type, transport: str = 'grpc_asyncio'): +async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=common.SignBlobRequest): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1780,7 +1769,7 @@ async def test_sign_blob_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1804,6 +1793,11 @@ async def test_sign_blob_async(request_type, transport: str = 'grpc_asyncio'): assert response.key_id == 'key_id_value' assert response.signed_blob == b'signed_blob_blob' + +@pytest.mark.asyncio +async def test_sign_blob_async_from_dict(): + await test_sign_blob_async(request_type=dict) + def test_sign_blob_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1970,10 +1964,8 @@ async def test_sign_blob_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - common.SignJwtRequest({ - }), - { - }, + common.SignJwtRequest, + dict, ]) def test_sign_jwt(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -1983,7 +1975,7 @@ def test_sign_jwt(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2032,11 +2024,10 @@ def test_sign_jwt_non_empty_request_with_auto_populated_field(): client.sign_jwt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = common.SignJwtRequest( + assert args[0] == common.SignJwtRequest( name='name_value', payload='payload_value', ) - assert args[0] == request_msg def test_sign_jwt_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2105,11 +2096,7 @@ async def test_sign_jwt_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - common.SignJwtRequest({ }), - { }, -]) -async def test_sign_jwt_async(request_type, transport: str = 'grpc_asyncio'): +async def test_sign_jwt_async(transport: str = 'grpc_asyncio', request_type=common.SignJwtRequest): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2117,7 +2104,7 @@ async def test_sign_jwt_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2141,6 +2128,11 @@ async def test_sign_jwt_async(request_type, transport: str = 'grpc_asyncio'): assert response.key_id == 'key_id_value' assert response.signed_jwt == 'signed_jwt_value' + +@pytest.mark.asyncio +async def test_sign_jwt_async_from_dict(): + await test_sign_jwt_async(request_type=dict) + def test_sign_jwt_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3131,6 +3123,7 @@ def test_generate_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() + assert args[0] == request_msg @@ -3153,6 +3146,7 @@ def test_generate_id_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() + assert args[0] == request_msg @@ -3175,6 +3169,7 @@ def test_sign_blob_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() + assert args[0] == request_msg @@ -3197,6 +3192,7 @@ def test_sign_jwt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() + assert args[0] == request_msg @@ -3238,6 +3234,7 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() + assert args[0] == request_msg @@ -3264,6 +3261,7 @@ async def test_generate_id_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() + assert args[0] == request_msg @@ -3291,6 +3289,7 @@ async def test_sign_blob_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() + assert args[0] == request_msg @@ -3318,6 +3317,7 @@ async def test_sign_jwt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() + assert args[0] == request_msg @@ -3781,6 +3781,7 @@ def test_generate_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() + assert args[0] == request_msg @@ -3802,6 +3803,7 @@ def test_generate_id_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() + assert args[0] == request_msg @@ -3823,6 +3825,7 @@ def test_sign_blob_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() + assert args[0] == request_msg @@ -3844,6 +3847,7 @@ def test_sign_jwt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index 8e7e63348ec5..d9f10062c6e3 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py @@ -986,10 +986,8 @@ def test_eventarc_client_create_channel_credentials_file(client_class, transport @pytest.mark.parametrize("request_type", [ - eventarc.GetTriggerRequest({ - }), - { - }, + eventarc.GetTriggerRequest, + dict, ]) def test_get_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -999,7 +997,7 @@ def test_get_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1057,10 +1055,9 @@ def test_get_trigger_non_empty_request_with_auto_populated_field(): client.get_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetTriggerRequest( + assert args[0] == eventarc.GetTriggerRequest( name='name_value', ) - assert args[0] == request_msg def test_get_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1129,11 +1126,7 @@ async def test_get_trigger_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetTriggerRequest({ }), - { }, -]) -async def test_get_trigger_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetTriggerRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1141,7 +1134,7 @@ async def test_get_trigger_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1175,6 +1168,11 @@ async def test_get_trigger_async(request_type, transport: str = 'grpc_asyncio'): assert response.satisfies_pzs is True assert response.etag == 'etag_value' + +@pytest.mark.asyncio +async def test_get_trigger_async_from_dict(): + await test_get_trigger_async(request_type=dict) + def test_get_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1321,10 +1319,8 @@ async def test_get_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListTriggersRequest({ - }), - { - }, + eventarc.ListTriggersRequest, + dict, ]) def test_list_triggers(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -1334,7 +1330,7 @@ def test_list_triggers(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1385,13 +1381,12 @@ def test_list_triggers_non_empty_request_with_auto_populated_field(): client.list_triggers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListTriggersRequest( + assert args[0] == eventarc.ListTriggersRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) - assert args[0] == request_msg def test_list_triggers_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1460,11 +1455,7 @@ async def test_list_triggers_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListTriggersRequest({ }), - { }, -]) -async def test_list_triggers_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_triggers_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListTriggersRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1472,7 +1463,7 @@ async def test_list_triggers_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1496,6 +1487,11 @@ async def test_list_triggers_async(request_type, transport: str = 'grpc_asyncio' assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_triggers_async_from_dict(): + await test_list_triggers_async(request_type=dict) + def test_list_triggers_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,10 +1832,8 @@ async def test_list_triggers_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateTriggerRequest({ - }), - { - }, + eventarc.CreateTriggerRequest, + dict, ]) def test_create_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -1849,7 +1843,7 @@ def test_create_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1893,11 +1887,10 @@ def test_create_trigger_non_empty_request_with_auto_populated_field(): client.create_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreateTriggerRequest( + assert args[0] == eventarc.CreateTriggerRequest( parent='parent_value', trigger_id='trigger_id_value', ) - assert args[0] == request_msg def test_create_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1976,11 +1969,7 @@ async def test_create_trigger_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreateTriggerRequest({ }), - { }, -]) -async def test_create_trigger_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateTriggerRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1988,7 +1977,7 @@ async def test_create_trigger_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2009,6 +1998,11 @@ async def test_create_trigger_async(request_type, transport: str = 'grpc_asyncio # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_trigger_async_from_dict(): + await test_create_trigger_async(request_type=dict) + def test_create_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2177,10 +2171,8 @@ async def test_create_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateTriggerRequest({ - }), - { - }, + eventarc.UpdateTriggerRequest, + dict, ]) def test_update_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -2190,7 +2182,7 @@ def test_update_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2232,9 +2224,8 @@ def test_update_trigger_non_empty_request_with_auto_populated_field(): client.update_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdateTriggerRequest( + assert args[0] == eventarc.UpdateTriggerRequest( ) - assert args[0] == request_msg def test_update_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2313,11 +2304,7 @@ async def test_update_trigger_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdateTriggerRequest({ }), - { }, -]) -async def test_update_trigger_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateTriggerRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2325,7 +2312,7 @@ async def test_update_trigger_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2346,6 +2333,11 @@ async def test_update_trigger_async(request_type, transport: str = 'grpc_asyncio # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_trigger_async_from_dict(): + await test_update_trigger_async(request_type=dict) + def test_update_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2514,10 +2506,8 @@ async def test_update_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteTriggerRequest({ - }), - { - }, + eventarc.DeleteTriggerRequest, + dict, ]) def test_delete_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -2527,7 +2517,7 @@ def test_delete_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2571,11 +2561,10 @@ def test_delete_trigger_non_empty_request_with_auto_populated_field(): client.delete_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeleteTriggerRequest( + assert args[0] == eventarc.DeleteTriggerRequest( name='name_value', etag='etag_value', ) - assert args[0] == request_msg def test_delete_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2654,11 +2643,7 @@ async def test_delete_trigger_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeleteTriggerRequest({ }), - { }, -]) -async def test_delete_trigger_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteTriggerRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2666,7 +2651,7 @@ async def test_delete_trigger_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2687,6 +2672,11 @@ async def test_delete_trigger_async(request_type, transport: str = 'grpc_asyncio # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_trigger_async_from_dict(): + await test_delete_trigger_async(request_type=dict) + def test_delete_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2845,10 +2835,8 @@ async def test_delete_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetChannelRequest({ - }), - { - }, + eventarc.GetChannelRequest, + dict, ]) def test_get_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -2858,7 +2846,7 @@ def test_get_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2917,10 +2905,9 @@ def test_get_channel_non_empty_request_with_auto_populated_field(): client.get_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetChannelRequest( + assert args[0] == eventarc.GetChannelRequest( name='name_value', ) - assert args[0] == request_msg def test_get_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2989,11 +2976,7 @@ async def test_get_channel_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetChannelRequest({ }), - { }, -]) -async def test_get_channel_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetChannelRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3001,7 +2984,7 @@ async def test_get_channel_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3035,6 +3018,11 @@ async def test_get_channel_async(request_type, transport: str = 'grpc_asyncio'): assert response.crypto_key_name == 'crypto_key_name_value' assert response.satisfies_pzs is True + +@pytest.mark.asyncio +async def test_get_channel_async_from_dict(): + await test_get_channel_async(request_type=dict) + def test_get_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3181,10 +3169,8 @@ async def test_get_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListChannelsRequest({ - }), - { - }, + eventarc.ListChannelsRequest, + dict, ]) def test_list_channels(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -3194,7 +3180,7 @@ def test_list_channels(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3244,12 +3230,11 @@ def test_list_channels_non_empty_request_with_auto_populated_field(): client.list_channels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListChannelsRequest( + assert args[0] == eventarc.ListChannelsRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', ) - assert args[0] == request_msg def test_list_channels_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3318,11 +3303,7 @@ async def test_list_channels_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListChannelsRequest({ }), - { }, -]) -async def test_list_channels_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_channels_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListChannelsRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3330,7 +3311,7 @@ async def test_list_channels_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3354,6 +3335,11 @@ async def test_list_channels_async(request_type, transport: str = 'grpc_asyncio' assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_channels_async_from_dict(): + await test_list_channels_async(request_type=dict) + def test_list_channels_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3694,10 +3680,8 @@ async def test_list_channels_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateChannelRequest({ - }), - { - }, + eventarc.CreateChannelRequest, + dict, ]) def test_create_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -3707,7 +3691,7 @@ def test_create_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3751,11 +3735,10 @@ def test_create_channel_non_empty_request_with_auto_populated_field(): client.create_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreateChannelRequest( + assert args[0] == eventarc.CreateChannelRequest( parent='parent_value', channel_id='channel_id_value', ) - assert args[0] == request_msg def test_create_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3834,11 +3817,7 @@ async def test_create_channel_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreateChannelRequest({ }), - { }, -]) -async def test_create_channel_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateChannelRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3846,7 +3825,7 @@ async def test_create_channel_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3867,6 +3846,11 @@ async def test_create_channel_async(request_type, transport: str = 'grpc_asyncio # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_channel_async_from_dict(): + await test_create_channel_async(request_type=dict) + def test_create_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4035,10 +4019,8 @@ async def test_create_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateChannelRequest({ - }), - { - }, + eventarc.UpdateChannelRequest, + dict, ]) def test_update_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -4048,7 +4030,7 @@ def test_update_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4090,9 +4072,8 @@ def test_update_channel_non_empty_request_with_auto_populated_field(): client.update_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdateChannelRequest( + assert args[0] == eventarc.UpdateChannelRequest( ) - assert args[0] == request_msg def test_update_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4171,11 +4152,7 @@ async def test_update_channel_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdateChannelRequest({ }), - { }, -]) -async def test_update_channel_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateChannelRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4183,7 +4160,7 @@ async def test_update_channel_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4204,6 +4181,11 @@ async def test_update_channel_async(request_type, transport: str = 'grpc_asyncio # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_channel_async_from_dict(): + await test_update_channel_async(request_type=dict) + def test_update_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4362,10 +4344,8 @@ async def test_update_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteChannelRequest({ - }), - { - }, + eventarc.DeleteChannelRequest, + dict, ]) def test_delete_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -4375,7 +4355,7 @@ def test_delete_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4418,10 +4398,9 @@ def test_delete_channel_non_empty_request_with_auto_populated_field(): client.delete_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeleteChannelRequest( + assert args[0] == eventarc.DeleteChannelRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4500,11 +4479,7 @@ async def test_delete_channel_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeleteChannelRequest({ }), - { }, -]) -async def test_delete_channel_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteChannelRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4512,7 +4487,7 @@ async def test_delete_channel_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4533,6 +4508,11 @@ async def test_delete_channel_async(request_type, transport: str = 'grpc_asyncio # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_channel_async_from_dict(): + await test_delete_channel_async(request_type=dict) + def test_delete_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4681,10 +4661,8 @@ async def test_delete_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetProviderRequest({ - }), - { - }, + eventarc.GetProviderRequest, + dict, ]) def test_get_provider(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -4694,7 +4672,7 @@ def test_get_provider(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4742,10 +4720,9 @@ def test_get_provider_non_empty_request_with_auto_populated_field(): client.get_provider(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetProviderRequest( + assert args[0] == eventarc.GetProviderRequest( name='name_value', ) - assert args[0] == request_msg def test_get_provider_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4814,11 +4791,7 @@ async def test_get_provider_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetProviderRequest({ }), - { }, -]) -async def test_get_provider_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_provider_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetProviderRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4826,7 +4799,7 @@ async def test_get_provider_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4850,6 +4823,11 @@ async def test_get_provider_async(request_type, transport: str = 'grpc_asyncio') assert response.name == 'name_value' assert response.display_name == 'display_name_value' + +@pytest.mark.asyncio +async def test_get_provider_async_from_dict(): + await test_get_provider_async(request_type=dict) + def test_get_provider_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4996,10 +4974,8 @@ async def test_get_provider_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListProvidersRequest({ - }), - { - }, + eventarc.ListProvidersRequest, + dict, ]) def test_list_providers(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -5009,7 +4985,7 @@ def test_list_providers(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5060,13 +5036,12 @@ def test_list_providers_non_empty_request_with_auto_populated_field(): client.list_providers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListProvidersRequest( + assert args[0] == eventarc.ListProvidersRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) - assert args[0] == request_msg def test_list_providers_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5135,11 +5110,7 @@ async def test_list_providers_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListProvidersRequest({ }), - { }, -]) -async def test_list_providers_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_providers_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListProvidersRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5147,7 +5118,7 @@ async def test_list_providers_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5171,6 +5142,11 @@ async def test_list_providers_async(request_type, transport: str = 'grpc_asyncio assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_providers_async_from_dict(): + await test_list_providers_async(request_type=dict) + def test_list_providers_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5511,10 +5487,8 @@ async def test_list_providers_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.GetChannelConnectionRequest({ - }), - { - }, + eventarc.GetChannelConnectionRequest, + dict, ]) def test_get_channel_connection(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -5524,7 +5498,7 @@ def test_get_channel_connection(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5576,10 +5550,9 @@ def test_get_channel_connection_non_empty_request_with_auto_populated_field(): client.get_channel_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetChannelConnectionRequest( + assert args[0] == eventarc.GetChannelConnectionRequest( name='name_value', ) - assert args[0] == request_msg def test_get_channel_connection_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5648,11 +5621,7 @@ async def test_get_channel_connection_async_use_cached_wrapped_rpc(transport: st assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetChannelConnectionRequest({ }), - { }, -]) -async def test_get_channel_connection_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetChannelConnectionRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5660,7 +5629,7 @@ async def test_get_channel_connection_async(request_type, transport: str = 'grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5688,6 +5657,11 @@ async def test_get_channel_connection_async(request_type, transport: str = 'grpc assert response.channel == 'channel_value' assert response.activation_token == 'activation_token_value' + +@pytest.mark.asyncio +async def test_get_channel_connection_async_from_dict(): + await test_get_channel_connection_async(request_type=dict) + def test_get_channel_connection_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5834,10 +5808,8 @@ async def test_get_channel_connection_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListChannelConnectionsRequest({ - }), - { - }, + eventarc.ListChannelConnectionsRequest, + dict, ]) def test_list_channel_connections(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -5847,7 +5819,7 @@ def test_list_channel_connections(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5896,11 +5868,10 @@ def test_list_channel_connections_non_empty_request_with_auto_populated_field(): client.list_channel_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListChannelConnectionsRequest( + assert args[0] == eventarc.ListChannelConnectionsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_channel_connections_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5969,11 +5940,7 @@ async def test_list_channel_connections_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListChannelConnectionsRequest({ }), - { }, -]) -async def test_list_channel_connections_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_channel_connections_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListChannelConnectionsRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5981,7 +5948,7 @@ async def test_list_channel_connections_async(request_type, transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6005,6 +5972,11 @@ async def test_list_channel_connections_async(request_type, transport: str = 'gr assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_channel_connections_async_from_dict(): + await test_list_channel_connections_async(request_type=dict) + def test_list_channel_connections_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6345,10 +6317,8 @@ async def test_list_channel_connections_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateChannelConnectionRequest({ - }), - { - }, + eventarc.CreateChannelConnectionRequest, + dict, ]) def test_create_channel_connection(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -6358,7 +6328,7 @@ def test_create_channel_connection(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6402,11 +6372,10 @@ def test_create_channel_connection_non_empty_request_with_auto_populated_field() client.create_channel_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreateChannelConnectionRequest( + assert args[0] == eventarc.CreateChannelConnectionRequest( parent='parent_value', channel_connection_id='channel_connection_id_value', ) - assert args[0] == request_msg def test_create_channel_connection_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6485,11 +6454,7 @@ async def test_create_channel_connection_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreateChannelConnectionRequest({ }), - { }, -]) -async def test_create_channel_connection_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateChannelConnectionRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6497,7 +6462,7 @@ async def test_create_channel_connection_async(request_type, transport: str = 'g # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6518,6 +6483,11 @@ async def test_create_channel_connection_async(request_type, transport: str = 'g # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_channel_connection_async_from_dict(): + await test_create_channel_connection_async(request_type=dict) + def test_create_channel_connection_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6686,10 +6656,8 @@ async def test_create_channel_connection_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteChannelConnectionRequest({ - }), - { - }, + eventarc.DeleteChannelConnectionRequest, + dict, ]) def test_delete_channel_connection(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -6699,7 +6667,7 @@ def test_delete_channel_connection(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6742,10 +6710,9 @@ def test_delete_channel_connection_non_empty_request_with_auto_populated_field() client.delete_channel_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeleteChannelConnectionRequest( + assert args[0] == eventarc.DeleteChannelConnectionRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_channel_connection_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6824,11 +6791,7 @@ async def test_delete_channel_connection_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeleteChannelConnectionRequest({ }), - { }, -]) -async def test_delete_channel_connection_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteChannelConnectionRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6836,7 +6799,7 @@ async def test_delete_channel_connection_async(request_type, transport: str = 'g # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6857,6 +6820,11 @@ async def test_delete_channel_connection_async(request_type, transport: str = 'g # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_channel_connection_async_from_dict(): + await test_delete_channel_connection_async(request_type=dict) + def test_delete_channel_connection_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7005,10 +6973,8 @@ async def test_delete_channel_connection_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetGoogleChannelConfigRequest({ - }), - { - }, + eventarc.GetGoogleChannelConfigRequest, + dict, ]) def test_get_google_channel_config(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7018,7 +6984,7 @@ def test_get_google_channel_config(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7066,10 +7032,9 @@ def test_get_google_channel_config_non_empty_request_with_auto_populated_field() client.get_google_channel_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetGoogleChannelConfigRequest( + assert args[0] == eventarc.GetGoogleChannelConfigRequest( name='name_value', ) - assert args[0] == request_msg def test_get_google_channel_config_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7138,11 +7103,7 @@ async def test_get_google_channel_config_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetGoogleChannelConfigRequest({ }), - { }, -]) -async def test_get_google_channel_config_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_google_channel_config_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetGoogleChannelConfigRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7150,7 +7111,7 @@ async def test_get_google_channel_config_async(request_type, transport: str = 'g # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7174,6 +7135,11 @@ async def test_get_google_channel_config_async(request_type, transport: str = 'g assert response.name == 'name_value' assert response.crypto_key_name == 'crypto_key_name_value' + +@pytest.mark.asyncio +async def test_get_google_channel_config_async_from_dict(): + await test_get_google_channel_config_async(request_type=dict) + def test_get_google_channel_config_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7320,10 +7286,8 @@ async def test_get_google_channel_config_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateGoogleChannelConfigRequest({ - }), - { - }, + eventarc.UpdateGoogleChannelConfigRequest, + dict, ]) def test_update_google_channel_config(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7333,7 +7297,7 @@ def test_update_google_channel_config(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7380,9 +7344,8 @@ def test_update_google_channel_config_non_empty_request_with_auto_populated_fiel client.update_google_channel_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdateGoogleChannelConfigRequest( + assert args[0] == eventarc.UpdateGoogleChannelConfigRequest( ) - assert args[0] == request_msg def test_update_google_channel_config_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7451,11 +7414,7 @@ async def test_update_google_channel_config_async_use_cached_wrapped_rpc(transpo assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdateGoogleChannelConfigRequest({ }), - { }, -]) -async def test_update_google_channel_config_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_google_channel_config_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateGoogleChannelConfigRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7463,7 +7422,7 @@ async def test_update_google_channel_config_async(request_type, transport: str = # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7487,6 +7446,11 @@ async def test_update_google_channel_config_async(request_type, transport: str = assert response.name == 'name_value' assert response.crypto_key_name == 'crypto_key_name_value' + +@pytest.mark.asyncio +async def test_update_google_channel_config_async_from_dict(): + await test_update_google_channel_config_async(request_type=dict) + def test_update_google_channel_config_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7643,10 +7607,8 @@ async def test_update_google_channel_config_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetMessageBusRequest({ - }), - { - }, + eventarc.GetMessageBusRequest, + dict, ]) def test_get_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7656,7 +7618,7 @@ def test_get_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7710,10 +7672,9 @@ def test_get_message_bus_non_empty_request_with_auto_populated_field(): client.get_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetMessageBusRequest( + assert args[0] == eventarc.GetMessageBusRequest( name='name_value', ) - assert args[0] == request_msg def test_get_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7782,11 +7743,7 @@ async def test_get_message_bus_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetMessageBusRequest({ }), - { }, -]) -async def test_get_message_bus_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetMessageBusRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7794,7 +7751,7 @@ async def test_get_message_bus_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7824,6 +7781,11 @@ async def test_get_message_bus_async(request_type, transport: str = 'grpc_asynci assert response.display_name == 'display_name_value' assert response.crypto_key_name == 'crypto_key_name_value' + +@pytest.mark.asyncio +async def test_get_message_bus_async_from_dict(): + await test_get_message_bus_async(request_type=dict) + def test_get_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7970,10 +7932,8 @@ async def test_get_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListMessageBusesRequest({ - }), - { - }, + eventarc.ListMessageBusesRequest, + dict, ]) def test_list_message_buses(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7983,7 +7943,7 @@ def test_list_message_buses(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8034,13 +7994,12 @@ def test_list_message_buses_non_empty_request_with_auto_populated_field(): client.list_message_buses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListMessageBusesRequest( + assert args[0] == eventarc.ListMessageBusesRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) - assert args[0] == request_msg def test_list_message_buses_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8109,11 +8068,7 @@ async def test_list_message_buses_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListMessageBusesRequest({ }), - { }, -]) -async def test_list_message_buses_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_message_buses_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListMessageBusesRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8121,7 +8076,7 @@ async def test_list_message_buses_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8145,6 +8100,11 @@ async def test_list_message_buses_async(request_type, transport: str = 'grpc_asy assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_message_buses_async_from_dict(): + await test_list_message_buses_async(request_type=dict) + def test_list_message_buses_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8485,10 +8445,8 @@ async def test_list_message_buses_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.ListMessageBusEnrollmentsRequest({ - }), - { - }, + eventarc.ListMessageBusEnrollmentsRequest, + dict, ]) def test_list_message_bus_enrollments(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -8498,7 +8456,7 @@ def test_list_message_bus_enrollments(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8549,11 +8507,10 @@ def test_list_message_bus_enrollments_non_empty_request_with_auto_populated_fiel client.list_message_bus_enrollments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListMessageBusEnrollmentsRequest( + assert args[0] == eventarc.ListMessageBusEnrollmentsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_message_bus_enrollments_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8622,11 +8579,7 @@ async def test_list_message_bus_enrollments_async_use_cached_wrapped_rpc(transpo assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListMessageBusEnrollmentsRequest({ }), - { }, -]) -async def test_list_message_bus_enrollments_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_message_bus_enrollments_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListMessageBusEnrollmentsRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8634,7 +8587,7 @@ async def test_list_message_bus_enrollments_async(request_type, transport: str = # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8660,6 +8613,11 @@ async def test_list_message_bus_enrollments_async(request_type, transport: str = assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_message_bus_enrollments_async_from_dict(): + await test_list_message_bus_enrollments_async(request_type=dict) + def test_list_message_bus_enrollments_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9000,10 +8958,8 @@ async def test_list_message_bus_enrollments_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateMessageBusRequest({ - }), - { - }, + eventarc.CreateMessageBusRequest, + dict, ]) def test_create_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -9013,7 +8969,7 @@ def test_create_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9057,11 +9013,10 @@ def test_create_message_bus_non_empty_request_with_auto_populated_field(): client.create_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreateMessageBusRequest( + assert args[0] == eventarc.CreateMessageBusRequest( parent='parent_value', message_bus_id='message_bus_id_value', ) - assert args[0] == request_msg def test_create_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9140,11 +9095,7 @@ async def test_create_message_bus_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreateMessageBusRequest({ }), - { }, -]) -async def test_create_message_bus_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateMessageBusRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9152,7 +9103,7 @@ async def test_create_message_bus_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9173,6 +9124,11 @@ async def test_create_message_bus_async(request_type, transport: str = 'grpc_asy # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_message_bus_async_from_dict(): + await test_create_message_bus_async(request_type=dict) + def test_create_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9341,10 +9297,8 @@ async def test_create_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateMessageBusRequest({ - }), - { - }, + eventarc.UpdateMessageBusRequest, + dict, ]) def test_update_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -9354,7 +9308,7 @@ def test_update_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9396,9 +9350,8 @@ def test_update_message_bus_non_empty_request_with_auto_populated_field(): client.update_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdateMessageBusRequest( + assert args[0] == eventarc.UpdateMessageBusRequest( ) - assert args[0] == request_msg def test_update_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9477,11 +9430,7 @@ async def test_update_message_bus_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdateMessageBusRequest({ }), - { }, -]) -async def test_update_message_bus_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateMessageBusRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9489,7 +9438,7 @@ async def test_update_message_bus_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9510,6 +9459,11 @@ async def test_update_message_bus_async(request_type, transport: str = 'grpc_asy # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_message_bus_async_from_dict(): + await test_update_message_bus_async(request_type=dict) + def test_update_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9668,10 +9622,8 @@ async def test_update_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteMessageBusRequest({ - }), - { - }, + eventarc.DeleteMessageBusRequest, + dict, ]) def test_delete_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -9681,7 +9633,7 @@ def test_delete_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9725,11 +9677,10 @@ def test_delete_message_bus_non_empty_request_with_auto_populated_field(): client.delete_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeleteMessageBusRequest( + assert args[0] == eventarc.DeleteMessageBusRequest( name='name_value', etag='etag_value', ) - assert args[0] == request_msg def test_delete_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9808,11 +9759,7 @@ async def test_delete_message_bus_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeleteMessageBusRequest({ }), - { }, -]) -async def test_delete_message_bus_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteMessageBusRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9820,7 +9767,7 @@ async def test_delete_message_bus_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9841,6 +9788,11 @@ async def test_delete_message_bus_async(request_type, transport: str = 'grpc_asy # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_message_bus_async_from_dict(): + await test_delete_message_bus_async(request_type=dict) + def test_delete_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9999,10 +9951,8 @@ async def test_delete_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetEnrollmentRequest({ - }), - { - }, + eventarc.GetEnrollmentRequest, + dict, ]) def test_get_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -10012,7 +9962,7 @@ def test_get_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10070,10 +10020,9 @@ def test_get_enrollment_non_empty_request_with_auto_populated_field(): client.get_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetEnrollmentRequest( + assert args[0] == eventarc.GetEnrollmentRequest( name='name_value', ) - assert args[0] == request_msg def test_get_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10142,11 +10091,7 @@ async def test_get_enrollment_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetEnrollmentRequest({ }), - { }, -]) -async def test_get_enrollment_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetEnrollmentRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10154,7 +10099,7 @@ async def test_get_enrollment_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10188,6 +10133,11 @@ async def test_get_enrollment_async(request_type, transport: str = 'grpc_asyncio assert response.message_bus == 'message_bus_value' assert response.destination == 'destination_value' + +@pytest.mark.asyncio +async def test_get_enrollment_async_from_dict(): + await test_get_enrollment_async(request_type=dict) + def test_get_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10334,10 +10284,8 @@ async def test_get_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListEnrollmentsRequest({ - }), - { - }, + eventarc.ListEnrollmentsRequest, + dict, ]) def test_list_enrollments(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -10347,7 +10295,7 @@ def test_list_enrollments(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10398,13 +10346,12 @@ def test_list_enrollments_non_empty_request_with_auto_populated_field(): client.list_enrollments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListEnrollmentsRequest( + assert args[0] == eventarc.ListEnrollmentsRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) - assert args[0] == request_msg def test_list_enrollments_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10473,11 +10420,7 @@ async def test_list_enrollments_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListEnrollmentsRequest({ }), - { }, -]) -async def test_list_enrollments_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_enrollments_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListEnrollmentsRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10485,7 +10428,7 @@ async def test_list_enrollments_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10509,6 +10452,11 @@ async def test_list_enrollments_async(request_type, transport: str = 'grpc_async assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_enrollments_async_from_dict(): + await test_list_enrollments_async(request_type=dict) + def test_list_enrollments_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10849,10 +10797,8 @@ async def test_list_enrollments_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateEnrollmentRequest({ - }), - { - }, + eventarc.CreateEnrollmentRequest, + dict, ]) def test_create_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -10862,7 +10808,7 @@ def test_create_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10906,11 +10852,10 @@ def test_create_enrollment_non_empty_request_with_auto_populated_field(): client.create_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreateEnrollmentRequest( + assert args[0] == eventarc.CreateEnrollmentRequest( parent='parent_value', enrollment_id='enrollment_id_value', ) - assert args[0] == request_msg def test_create_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10989,11 +10934,7 @@ async def test_create_enrollment_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreateEnrollmentRequest({ }), - { }, -]) -async def test_create_enrollment_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateEnrollmentRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11001,7 +10942,7 @@ async def test_create_enrollment_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11022,6 +10963,11 @@ async def test_create_enrollment_async(request_type, transport: str = 'grpc_asyn # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_enrollment_async_from_dict(): + await test_create_enrollment_async(request_type=dict) + def test_create_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11190,10 +11136,8 @@ async def test_create_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateEnrollmentRequest({ - }), - { - }, + eventarc.UpdateEnrollmentRequest, + dict, ]) def test_update_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -11203,7 +11147,7 @@ def test_update_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11245,9 +11189,8 @@ def test_update_enrollment_non_empty_request_with_auto_populated_field(): client.update_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdateEnrollmentRequest( + assert args[0] == eventarc.UpdateEnrollmentRequest( ) - assert args[0] == request_msg def test_update_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11326,11 +11269,7 @@ async def test_update_enrollment_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdateEnrollmentRequest({ }), - { }, -]) -async def test_update_enrollment_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateEnrollmentRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11338,7 +11277,7 @@ async def test_update_enrollment_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11359,6 +11298,11 @@ async def test_update_enrollment_async(request_type, transport: str = 'grpc_asyn # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_enrollment_async_from_dict(): + await test_update_enrollment_async(request_type=dict) + def test_update_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11517,10 +11461,8 @@ async def test_update_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteEnrollmentRequest({ - }), - { - }, + eventarc.DeleteEnrollmentRequest, + dict, ]) def test_delete_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -11530,7 +11472,7 @@ def test_delete_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11574,11 +11516,10 @@ def test_delete_enrollment_non_empty_request_with_auto_populated_field(): client.delete_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeleteEnrollmentRequest( + assert args[0] == eventarc.DeleteEnrollmentRequest( name='name_value', etag='etag_value', ) - assert args[0] == request_msg def test_delete_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11657,11 +11598,7 @@ async def test_delete_enrollment_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeleteEnrollmentRequest({ }), - { }, -]) -async def test_delete_enrollment_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteEnrollmentRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11669,7 +11606,7 @@ async def test_delete_enrollment_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11690,6 +11627,11 @@ async def test_delete_enrollment_async(request_type, transport: str = 'grpc_asyn # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_enrollment_async_from_dict(): + await test_delete_enrollment_async(request_type=dict) + def test_delete_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11848,10 +11790,8 @@ async def test_delete_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetPipelineRequest({ - }), - { - }, + eventarc.GetPipelineRequest, + dict, ]) def test_get_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -11861,7 +11801,7 @@ def test_get_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11917,10 +11857,9 @@ def test_get_pipeline_non_empty_request_with_auto_populated_field(): client.get_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetPipelineRequest( + assert args[0] == eventarc.GetPipelineRequest( name='name_value', ) - assert args[0] == request_msg def test_get_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11989,11 +11928,7 @@ async def test_get_pipeline_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetPipelineRequest({ }), - { }, -]) -async def test_get_pipeline_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetPipelineRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12001,7 +11936,7 @@ async def test_get_pipeline_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12033,6 +11968,11 @@ async def test_get_pipeline_async(request_type, transport: str = 'grpc_asyncio') assert response.etag == 'etag_value' assert response.satisfies_pzs is True + +@pytest.mark.asyncio +async def test_get_pipeline_async_from_dict(): + await test_get_pipeline_async(request_type=dict) + def test_get_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12179,10 +12119,8 @@ async def test_get_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListPipelinesRequest({ - }), - { - }, + eventarc.ListPipelinesRequest, + dict, ]) def test_list_pipelines(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -12192,7 +12130,7 @@ def test_list_pipelines(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12243,13 +12181,12 @@ def test_list_pipelines_non_empty_request_with_auto_populated_field(): client.list_pipelines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListPipelinesRequest( + assert args[0] == eventarc.ListPipelinesRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) - assert args[0] == request_msg def test_list_pipelines_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -12318,11 +12255,7 @@ async def test_list_pipelines_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListPipelinesRequest({ }), - { }, -]) -async def test_list_pipelines_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_pipelines_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListPipelinesRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12330,7 +12263,7 @@ async def test_list_pipelines_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12354,6 +12287,11 @@ async def test_list_pipelines_async(request_type, transport: str = 'grpc_asyncio assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_pipelines_async_from_dict(): + await test_list_pipelines_async(request_type=dict) + def test_list_pipelines_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12694,10 +12632,8 @@ async def test_list_pipelines_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreatePipelineRequest({ - }), - { - }, + eventarc.CreatePipelineRequest, + dict, ]) def test_create_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -12707,7 +12643,7 @@ def test_create_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12751,11 +12687,10 @@ def test_create_pipeline_non_empty_request_with_auto_populated_field(): client.create_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreatePipelineRequest( + assert args[0] == eventarc.CreatePipelineRequest( parent='parent_value', pipeline_id='pipeline_id_value', ) - assert args[0] == request_msg def test_create_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -12834,11 +12769,7 @@ async def test_create_pipeline_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreatePipelineRequest({ }), - { }, -]) -async def test_create_pipeline_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreatePipelineRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12846,7 +12777,7 @@ async def test_create_pipeline_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12867,6 +12798,11 @@ async def test_create_pipeline_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_pipeline_async_from_dict(): + await test_create_pipeline_async(request_type=dict) + def test_create_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13035,10 +12971,8 @@ async def test_create_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdatePipelineRequest({ - }), - { - }, + eventarc.UpdatePipelineRequest, + dict, ]) def test_update_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -13048,7 +12982,7 @@ def test_update_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13090,9 +13024,8 @@ def test_update_pipeline_non_empty_request_with_auto_populated_field(): client.update_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdatePipelineRequest( + assert args[0] == eventarc.UpdatePipelineRequest( ) - assert args[0] == request_msg def test_update_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -13171,11 +13104,7 @@ async def test_update_pipeline_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdatePipelineRequest({ }), - { }, -]) -async def test_update_pipeline_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdatePipelineRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13183,7 +13112,7 @@ async def test_update_pipeline_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13204,6 +13133,11 @@ async def test_update_pipeline_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_pipeline_async_from_dict(): + await test_update_pipeline_async(request_type=dict) + def test_update_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13362,10 +13296,8 @@ async def test_update_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeletePipelineRequest({ - }), - { - }, + eventarc.DeletePipelineRequest, + dict, ]) def test_delete_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -13375,7 +13307,7 @@ def test_delete_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13419,11 +13351,10 @@ def test_delete_pipeline_non_empty_request_with_auto_populated_field(): client.delete_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeletePipelineRequest( + assert args[0] == eventarc.DeletePipelineRequest( name='name_value', etag='etag_value', ) - assert args[0] == request_msg def test_delete_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -13502,11 +13433,7 @@ async def test_delete_pipeline_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeletePipelineRequest({ }), - { }, -]) -async def test_delete_pipeline_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeletePipelineRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13514,7 +13441,7 @@ async def test_delete_pipeline_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13535,6 +13462,11 @@ async def test_delete_pipeline_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_pipeline_async_from_dict(): + await test_delete_pipeline_async(request_type=dict) + def test_delete_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13693,10 +13625,8 @@ async def test_delete_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetGoogleApiSourceRequest({ - }), - { - }, + eventarc.GetGoogleApiSourceRequest, + dict, ]) def test_get_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -13706,7 +13636,7 @@ def test_get_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13762,10 +13692,9 @@ def test_get_google_api_source_non_empty_request_with_auto_populated_field(): client.get_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.GetGoogleApiSourceRequest( + assert args[0] == eventarc.GetGoogleApiSourceRequest( name='name_value', ) - assert args[0] == request_msg def test_get_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -13834,11 +13763,7 @@ async def test_get_google_api_source_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.GetGoogleApiSourceRequest({ }), - { }, -]) -async def test_get_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetGoogleApiSourceRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13846,7 +13771,7 @@ async def test_get_google_api_source_async(request_type, transport: str = 'grpc_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13878,6 +13803,11 @@ async def test_get_google_api_source_async(request_type, transport: str = 'grpc_ assert response.destination == 'destination_value' assert response.crypto_key_name == 'crypto_key_name_value' + +@pytest.mark.asyncio +async def test_get_google_api_source_async_from_dict(): + await test_get_google_api_source_async(request_type=dict) + def test_get_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14024,10 +13954,8 @@ async def test_get_google_api_source_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListGoogleApiSourcesRequest({ - }), - { - }, + eventarc.ListGoogleApiSourcesRequest, + dict, ]) def test_list_google_api_sources(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -14037,7 +13965,7 @@ def test_list_google_api_sources(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14088,13 +14016,12 @@ def test_list_google_api_sources_non_empty_request_with_auto_populated_field(): client.list_google_api_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.ListGoogleApiSourcesRequest( + assert args[0] == eventarc.ListGoogleApiSourcesRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) - assert args[0] == request_msg def test_list_google_api_sources_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -14163,11 +14090,7 @@ async def test_list_google_api_sources_async_use_cached_wrapped_rpc(transport: s assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.ListGoogleApiSourcesRequest({ }), - { }, -]) -async def test_list_google_api_sources_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_google_api_sources_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListGoogleApiSourcesRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14175,7 +14098,7 @@ async def test_list_google_api_sources_async(request_type, transport: str = 'grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14199,6 +14122,11 @@ async def test_list_google_api_sources_async(request_type, transport: str = 'grp assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_google_api_sources_async_from_dict(): + await test_list_google_api_sources_async(request_type=dict) + def test_list_google_api_sources_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14539,10 +14467,8 @@ async def test_list_google_api_sources_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateGoogleApiSourceRequest({ - }), - { - }, + eventarc.CreateGoogleApiSourceRequest, + dict, ]) def test_create_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -14552,7 +14478,7 @@ def test_create_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14596,11 +14522,10 @@ def test_create_google_api_source_non_empty_request_with_auto_populated_field(): client.create_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.CreateGoogleApiSourceRequest( + assert args[0] == eventarc.CreateGoogleApiSourceRequest( parent='parent_value', google_api_source_id='google_api_source_id_value', ) - assert args[0] == request_msg def test_create_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -14679,11 +14604,7 @@ async def test_create_google_api_source_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.CreateGoogleApiSourceRequest({ }), - { }, -]) -async def test_create_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateGoogleApiSourceRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14691,7 +14612,7 @@ async def test_create_google_api_source_async(request_type, transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14712,6 +14633,11 @@ async def test_create_google_api_source_async(request_type, transport: str = 'gr # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_google_api_source_async_from_dict(): + await test_create_google_api_source_async(request_type=dict) + def test_create_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14880,10 +14806,8 @@ async def test_create_google_api_source_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateGoogleApiSourceRequest({ - }), - { - }, + eventarc.UpdateGoogleApiSourceRequest, + dict, ]) def test_update_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -14893,7 +14817,7 @@ def test_update_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14935,9 +14859,8 @@ def test_update_google_api_source_non_empty_request_with_auto_populated_field(): client.update_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.UpdateGoogleApiSourceRequest( + assert args[0] == eventarc.UpdateGoogleApiSourceRequest( ) - assert args[0] == request_msg def test_update_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -15016,11 +14939,7 @@ async def test_update_google_api_source_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.UpdateGoogleApiSourceRequest({ }), - { }, -]) -async def test_update_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateGoogleApiSourceRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15028,7 +14947,7 @@ async def test_update_google_api_source_async(request_type, transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15049,6 +14968,11 @@ async def test_update_google_api_source_async(request_type, transport: str = 'gr # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_google_api_source_async_from_dict(): + await test_update_google_api_source_async(request_type=dict) + def test_update_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15207,10 +15131,8 @@ async def test_update_google_api_source_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteGoogleApiSourceRequest({ - }), - { - }, + eventarc.DeleteGoogleApiSourceRequest, + dict, ]) def test_delete_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -15220,7 +15142,7 @@ def test_delete_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15264,11 +15186,10 @@ def test_delete_google_api_source_non_empty_request_with_auto_populated_field(): client.delete_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = eventarc.DeleteGoogleApiSourceRequest( + assert args[0] == eventarc.DeleteGoogleApiSourceRequest( name='name_value', etag='etag_value', ) - assert args[0] == request_msg def test_delete_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -15347,11 +15268,7 @@ async def test_delete_google_api_source_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - eventarc.DeleteGoogleApiSourceRequest({ }), - { }, -]) -async def test_delete_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteGoogleApiSourceRequest): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15359,7 +15276,7 @@ async def test_delete_google_api_source_async(request_type, transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15380,6 +15297,11 @@ async def test_delete_google_api_source_async(request_type, transport: str = 'gr # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_google_api_source_async_from_dict(): + await test_delete_google_api_source_async(request_type=dict) + def test_delete_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22692,6 +22614,7 @@ def test_get_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() + assert args[0] == request_msg @@ -22714,6 +22637,7 @@ def test_list_triggers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() + assert args[0] == request_msg @@ -22736,6 +22660,7 @@ def test_create_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() + assert args[0] == request_msg @@ -22758,6 +22683,7 @@ def test_update_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() + assert args[0] == request_msg @@ -22780,6 +22706,7 @@ def test_delete_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() + assert args[0] == request_msg @@ -22802,6 +22729,7 @@ def test_get_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() + assert args[0] == request_msg @@ -22824,6 +22752,7 @@ def test_list_channels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() + assert args[0] == request_msg @@ -22846,6 +22775,7 @@ def test_create_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() + assert args[0] == request_msg @@ -22868,6 +22798,7 @@ def test_update_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() + assert args[0] == request_msg @@ -22890,6 +22821,7 @@ def test_delete_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() + assert args[0] == request_msg @@ -22912,6 +22844,7 @@ def test_get_provider_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() + assert args[0] == request_msg @@ -22934,6 +22867,7 @@ def test_list_providers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() + assert args[0] == request_msg @@ -22956,6 +22890,7 @@ def test_get_channel_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() + assert args[0] == request_msg @@ -22978,6 +22913,7 @@ def test_list_channel_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() + assert args[0] == request_msg @@ -23000,6 +22936,7 @@ def test_create_channel_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() + assert args[0] == request_msg @@ -23022,6 +22959,7 @@ def test_delete_channel_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() + assert args[0] == request_msg @@ -23044,6 +22982,7 @@ def test_get_google_channel_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() + assert args[0] == request_msg @@ -23066,6 +23005,7 @@ def test_update_google_channel_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() + assert args[0] == request_msg @@ -23088,6 +23028,7 @@ def test_get_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetMessageBusRequest() + assert args[0] == request_msg @@ -23110,6 +23051,7 @@ def test_list_message_buses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusesRequest() + assert args[0] == request_msg @@ -23132,6 +23074,7 @@ def test_list_message_bus_enrollments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusEnrollmentsRequest() + assert args[0] == request_msg @@ -23154,6 +23097,7 @@ def test_create_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateMessageBusRequest() + assert args[0] == request_msg @@ -23176,6 +23120,7 @@ def test_update_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateMessageBusRequest() + assert args[0] == request_msg @@ -23198,6 +23143,7 @@ def test_delete_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteMessageBusRequest() + assert args[0] == request_msg @@ -23220,6 +23166,7 @@ def test_get_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetEnrollmentRequest() + assert args[0] == request_msg @@ -23242,6 +23189,7 @@ def test_list_enrollments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListEnrollmentsRequest() + assert args[0] == request_msg @@ -23264,6 +23212,7 @@ def test_create_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateEnrollmentRequest() + assert args[0] == request_msg @@ -23286,6 +23235,7 @@ def test_update_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateEnrollmentRequest() + assert args[0] == request_msg @@ -23308,6 +23258,7 @@ def test_delete_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteEnrollmentRequest() + assert args[0] == request_msg @@ -23330,6 +23281,7 @@ def test_get_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetPipelineRequest() + assert args[0] == request_msg @@ -23352,6 +23304,7 @@ def test_list_pipelines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListPipelinesRequest() + assert args[0] == request_msg @@ -23374,6 +23327,7 @@ def test_create_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreatePipelineRequest() + assert args[0] == request_msg @@ -23396,6 +23350,7 @@ def test_update_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdatePipelineRequest() + assert args[0] == request_msg @@ -23418,6 +23373,7 @@ def test_delete_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeletePipelineRequest() + assert args[0] == request_msg @@ -23440,6 +23396,7 @@ def test_get_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleApiSourceRequest() + assert args[0] == request_msg @@ -23462,6 +23419,7 @@ def test_list_google_api_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListGoogleApiSourcesRequest() + assert args[0] == request_msg @@ -23484,6 +23442,7 @@ def test_create_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateGoogleApiSourceRequest() + assert args[0] == request_msg @@ -23506,6 +23465,7 @@ def test_update_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleApiSourceRequest() + assert args[0] == request_msg @@ -23528,6 +23488,7 @@ def test_delete_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteGoogleApiSourceRequest() + assert args[0] == request_msg @@ -23575,6 +23536,7 @@ async def test_get_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() + assert args[0] == request_msg @@ -23602,6 +23564,7 @@ async def test_list_triggers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() + assert args[0] == request_msg @@ -23628,6 +23591,7 @@ async def test_create_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() + assert args[0] == request_msg @@ -23654,6 +23618,7 @@ async def test_update_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() + assert args[0] == request_msg @@ -23680,6 +23645,7 @@ async def test_delete_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() + assert args[0] == request_msg @@ -23712,6 +23678,7 @@ async def test_get_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() + assert args[0] == request_msg @@ -23739,6 +23706,7 @@ async def test_list_channels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() + assert args[0] == request_msg @@ -23765,6 +23733,7 @@ async def test_create_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() + assert args[0] == request_msg @@ -23791,6 +23760,7 @@ async def test_update_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() + assert args[0] == request_msg @@ -23817,6 +23787,7 @@ async def test_delete_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() + assert args[0] == request_msg @@ -23844,6 +23815,7 @@ async def test_get_provider_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() + assert args[0] == request_msg @@ -23871,6 +23843,7 @@ async def test_list_providers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() + assert args[0] == request_msg @@ -23900,6 +23873,7 @@ async def test_get_channel_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() + assert args[0] == request_msg @@ -23927,6 +23901,7 @@ async def test_list_channel_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() + assert args[0] == request_msg @@ -23953,6 +23928,7 @@ async def test_create_channel_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() + assert args[0] == request_msg @@ -23979,6 +23955,7 @@ async def test_delete_channel_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() + assert args[0] == request_msg @@ -24006,6 +23983,7 @@ async def test_get_google_channel_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() + assert args[0] == request_msg @@ -24033,6 +24011,7 @@ async def test_update_google_channel_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() + assert args[0] == request_msg @@ -24063,6 +24042,7 @@ async def test_get_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetMessageBusRequest() + assert args[0] == request_msg @@ -24090,6 +24070,7 @@ async def test_list_message_buses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusesRequest() + assert args[0] == request_msg @@ -24118,6 +24099,7 @@ async def test_list_message_bus_enrollments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusEnrollmentsRequest() + assert args[0] == request_msg @@ -24144,6 +24126,7 @@ async def test_create_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateMessageBusRequest() + assert args[0] == request_msg @@ -24170,6 +24153,7 @@ async def test_update_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateMessageBusRequest() + assert args[0] == request_msg @@ -24196,6 +24180,7 @@ async def test_delete_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteMessageBusRequest() + assert args[0] == request_msg @@ -24228,6 +24213,7 @@ async def test_get_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetEnrollmentRequest() + assert args[0] == request_msg @@ -24255,6 +24241,7 @@ async def test_list_enrollments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListEnrollmentsRequest() + assert args[0] == request_msg @@ -24281,6 +24268,7 @@ async def test_create_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateEnrollmentRequest() + assert args[0] == request_msg @@ -24307,6 +24295,7 @@ async def test_update_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateEnrollmentRequest() + assert args[0] == request_msg @@ -24333,6 +24322,7 @@ async def test_delete_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteEnrollmentRequest() + assert args[0] == request_msg @@ -24364,6 +24354,7 @@ async def test_get_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetPipelineRequest() + assert args[0] == request_msg @@ -24391,6 +24382,7 @@ async def test_list_pipelines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListPipelinesRequest() + assert args[0] == request_msg @@ -24417,6 +24409,7 @@ async def test_create_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreatePipelineRequest() + assert args[0] == request_msg @@ -24443,6 +24436,7 @@ async def test_update_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdatePipelineRequest() + assert args[0] == request_msg @@ -24469,6 +24463,7 @@ async def test_delete_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeletePipelineRequest() + assert args[0] == request_msg @@ -24500,6 +24495,7 @@ async def test_get_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleApiSourceRequest() + assert args[0] == request_msg @@ -24527,6 +24523,7 @@ async def test_list_google_api_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListGoogleApiSourcesRequest() + assert args[0] == request_msg @@ -24553,6 +24550,7 @@ async def test_create_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateGoogleApiSourceRequest() + assert args[0] == request_msg @@ -24579,6 +24577,7 @@ async def test_update_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleApiSourceRequest() + assert args[0] == request_msg @@ -24605,6 +24604,7 @@ async def test_delete_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteGoogleApiSourceRequest() + assert args[0] == request_msg @@ -30144,6 +30144,7 @@ def test_get_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() + assert args[0] == request_msg @@ -30165,6 +30166,7 @@ def test_list_triggers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() + assert args[0] == request_msg @@ -30186,6 +30188,7 @@ def test_create_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() + assert args[0] == request_msg @@ -30207,6 +30210,7 @@ def test_update_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() + assert args[0] == request_msg @@ -30228,6 +30232,7 @@ def test_delete_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() + assert args[0] == request_msg @@ -30249,6 +30254,7 @@ def test_get_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() + assert args[0] == request_msg @@ -30270,6 +30276,7 @@ def test_list_channels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() + assert args[0] == request_msg @@ -30291,6 +30298,7 @@ def test_create_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() + assert args[0] == request_msg @@ -30312,6 +30320,7 @@ def test_update_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() + assert args[0] == request_msg @@ -30333,6 +30342,7 @@ def test_delete_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() + assert args[0] == request_msg @@ -30354,6 +30364,7 @@ def test_get_provider_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() + assert args[0] == request_msg @@ -30375,6 +30386,7 @@ def test_list_providers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() + assert args[0] == request_msg @@ -30396,6 +30408,7 @@ def test_get_channel_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() + assert args[0] == request_msg @@ -30417,6 +30430,7 @@ def test_list_channel_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() + assert args[0] == request_msg @@ -30438,6 +30452,7 @@ def test_create_channel_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() + assert args[0] == request_msg @@ -30459,6 +30474,7 @@ def test_delete_channel_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() + assert args[0] == request_msg @@ -30480,6 +30496,7 @@ def test_get_google_channel_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() + assert args[0] == request_msg @@ -30501,6 +30518,7 @@ def test_update_google_channel_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() + assert args[0] == request_msg @@ -30522,6 +30540,7 @@ def test_get_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetMessageBusRequest() + assert args[0] == request_msg @@ -30543,6 +30562,7 @@ def test_list_message_buses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusesRequest() + assert args[0] == request_msg @@ -30564,6 +30584,7 @@ def test_list_message_bus_enrollments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusEnrollmentsRequest() + assert args[0] == request_msg @@ -30585,6 +30606,7 @@ def test_create_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateMessageBusRequest() + assert args[0] == request_msg @@ -30606,6 +30628,7 @@ def test_update_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateMessageBusRequest() + assert args[0] == request_msg @@ -30627,6 +30650,7 @@ def test_delete_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteMessageBusRequest() + assert args[0] == request_msg @@ -30648,6 +30672,7 @@ def test_get_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetEnrollmentRequest() + assert args[0] == request_msg @@ -30669,6 +30694,7 @@ def test_list_enrollments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListEnrollmentsRequest() + assert args[0] == request_msg @@ -30690,6 +30716,7 @@ def test_create_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateEnrollmentRequest() + assert args[0] == request_msg @@ -30711,6 +30738,7 @@ def test_update_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateEnrollmentRequest() + assert args[0] == request_msg @@ -30732,6 +30760,7 @@ def test_delete_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteEnrollmentRequest() + assert args[0] == request_msg @@ -30753,6 +30782,7 @@ def test_get_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetPipelineRequest() + assert args[0] == request_msg @@ -30774,6 +30804,7 @@ def test_list_pipelines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListPipelinesRequest() + assert args[0] == request_msg @@ -30795,6 +30826,7 @@ def test_create_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreatePipelineRequest() + assert args[0] == request_msg @@ -30816,6 +30848,7 @@ def test_update_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdatePipelineRequest() + assert args[0] == request_msg @@ -30837,6 +30870,7 @@ def test_delete_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeletePipelineRequest() + assert args[0] == request_msg @@ -30858,6 +30892,7 @@ def test_get_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleApiSourceRequest() + assert args[0] == request_msg @@ -30879,6 +30914,7 @@ def test_list_google_api_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListGoogleApiSourcesRequest() + assert args[0] == request_msg @@ -30900,6 +30936,7 @@ def test_create_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateGoogleApiSourceRequest() + assert args[0] == request_msg @@ -30921,6 +30958,7 @@ def test_update_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleApiSourceRequest() + assert args[0] == request_msg @@ -30942,6 +30980,7 @@ def test_delete_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteGoogleApiSourceRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index d5d1ea7d6c24..ed083d5df952 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -944,10 +944,8 @@ def test_config_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging_config.ListBucketsRequest({ - }), - { - }, + logging_config.ListBucketsRequest, + dict, ]) def test_list_buckets(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -957,7 +955,7 @@ def test_list_buckets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1004,11 +1002,10 @@ def test_list_buckets_non_empty_request_with_auto_populated_field(): client.list_buckets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListBucketsRequest( + assert args[0] == logging_config.ListBucketsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_buckets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1077,11 +1074,7 @@ async def test_list_buckets_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListBucketsRequest({ }), - { }, -]) -async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListBucketsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1089,7 +1082,7 @@ async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1111,6 +1104,11 @@ async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio') assert isinstance(response, pagers.ListBucketsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_buckets_async_from_dict(): + await test_list_buckets_async(request_type=dict) + def test_list_buckets_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1451,10 +1449,8 @@ async def test_list_buckets_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetBucketRequest({ - }), - { - }, + logging_config.GetBucketRequest, + dict, ]) def test_get_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -1464,7 +1460,7 @@ def test_get_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1522,10 +1518,9 @@ def test_get_bucket_non_empty_request_with_auto_populated_field(): client.get_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetBucketRequest( + assert args[0] == logging_config.GetBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_get_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1594,11 +1589,7 @@ async def test_get_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetBucketRequest({ }), - { }, -]) -async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1606,7 +1597,7 @@ async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1640,6 +1631,11 @@ async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] + +@pytest.mark.asyncio +async def test_get_bucket_async_from_dict(): + await test_get_bucket_async(request_type=dict) + def test_get_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1704,10 +1700,8 @@ async def test_get_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ - }), - { - }, + logging_config.CreateBucketRequest, + dict, ]) def test_create_bucket_async(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -1717,7 +1711,7 @@ def test_create_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1761,11 +1755,10 @@ def test_create_bucket_async_non_empty_request_with_auto_populated_field(): client.create_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateBucketRequest( + assert args[0] == logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) - assert args[0] == request_msg def test_create_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1844,11 +1837,7 @@ async def test_create_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ }), - { }, -]) -async def test_create_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1856,7 +1845,7 @@ async def test_create_bucket_async_async(request_type, transport: str = 'grpc_as # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1877,6 +1866,11 @@ async def test_create_bucket_async_async(request_type, transport: str = 'grpc_as # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_bucket_async_async_from_dict(): + await test_create_bucket_async_async(request_type=dict) + def test_create_bucket_async_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1941,10 +1935,8 @@ async def test_create_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ - }), - { - }, + logging_config.UpdateBucketRequest, + dict, ]) def test_update_bucket_async(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -1954,7 +1946,7 @@ def test_update_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1997,10 +1989,9 @@ def test_update_bucket_async_non_empty_request_with_auto_populated_field(): client.update_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateBucketRequest( + assert args[0] == logging_config.UpdateBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_update_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2079,11 +2070,7 @@ async def test_update_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ }), - { }, -]) -async def test_update_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2091,7 +2078,7 @@ async def test_update_bucket_async_async(request_type, transport: str = 'grpc_as # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2112,6 +2099,11 @@ async def test_update_bucket_async_async(request_type, transport: str = 'grpc_as # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_bucket_async_async_from_dict(): + await test_update_bucket_async_async(request_type=dict) + def test_update_bucket_async_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2176,10 +2168,8 @@ async def test_update_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ - }), - { - }, + logging_config.CreateBucketRequest, + dict, ]) def test_create_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2189,7 +2179,7 @@ def test_create_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2248,11 +2238,10 @@ def test_create_bucket_non_empty_request_with_auto_populated_field(): client.create_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateBucketRequest( + assert args[0] == logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) - assert args[0] == request_msg def test_create_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2321,11 +2310,7 @@ async def test_create_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ }), - { }, -]) -async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2333,7 +2318,7 @@ async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2367,6 +2352,11 @@ async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio' assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] + +@pytest.mark.asyncio +async def test_create_bucket_async_from_dict(): + await test_create_bucket_async(request_type=dict) + def test_create_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2431,10 +2421,8 @@ async def test_create_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ - }), - { - }, + logging_config.UpdateBucketRequest, + dict, ]) def test_update_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2444,7 +2432,7 @@ def test_update_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2502,10 +2490,9 @@ def test_update_bucket_non_empty_request_with_auto_populated_field(): client.update_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateBucketRequest( + assert args[0] == logging_config.UpdateBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_update_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2574,11 +2561,7 @@ async def test_update_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ }), - { }, -]) -async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2586,7 +2569,7 @@ async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2620,6 +2603,11 @@ async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio' assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] + +@pytest.mark.asyncio +async def test_update_bucket_async_from_dict(): + await test_update_bucket_async(request_type=dict) + def test_update_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2684,10 +2672,8 @@ async def test_update_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteBucketRequest({ - }), - { - }, + logging_config.DeleteBucketRequest, + dict, ]) def test_delete_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2697,7 +2683,7 @@ def test_delete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2740,10 +2726,9 @@ def test_delete_bucket_non_empty_request_with_auto_populated_field(): client.delete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteBucketRequest( + assert args[0] == logging_config.DeleteBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2812,11 +2797,7 @@ async def test_delete_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteBucketRequest({ }), - { }, -]) -async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2824,7 +2805,7 @@ async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2843,6 +2824,11 @@ async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio' # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_bucket_async_from_dict(): + await test_delete_bucket_async(request_type=dict) + def test_delete_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2907,10 +2893,8 @@ async def test_delete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UndeleteBucketRequest({ - }), - { - }, + logging_config.UndeleteBucketRequest, + dict, ]) def test_undelete_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2920,7 +2904,7 @@ def test_undelete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2963,10 +2947,9 @@ def test_undelete_bucket_non_empty_request_with_auto_populated_field(): client.undelete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UndeleteBucketRequest( + assert args[0] == logging_config.UndeleteBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_undelete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3035,11 +3018,7 @@ async def test_undelete_bucket_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UndeleteBucketRequest({ }), - { }, -]) -async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UndeleteBucketRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3047,7 +3026,7 @@ async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3066,6 +3045,11 @@ async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_undelete_bucket_async_from_dict(): + await test_undelete_bucket_async(request_type=dict) + def test_undelete_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3130,10 +3114,8 @@ async def test_undelete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListViewsRequest({ - }), - { - }, + logging_config.ListViewsRequest, + dict, ]) def test_list_views(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -3143,7 +3125,7 @@ def test_list_views(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3190,11 +3172,10 @@ def test_list_views_non_empty_request_with_auto_populated_field(): client.list_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListViewsRequest( + assert args[0] == logging_config.ListViewsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_views_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3263,11 +3244,7 @@ async def test_list_views_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListViewsRequest({ }), - { }, -]) -async def test_list_views_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_views_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListViewsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3275,7 +3252,7 @@ async def test_list_views_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3297,6 +3274,11 @@ async def test_list_views_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListViewsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_views_async_from_dict(): + await test_list_views_async(request_type=dict) + def test_list_views_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3637,10 +3619,8 @@ async def test_list_views_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetViewRequest({ - }), - { - }, + logging_config.GetViewRequest, + dict, ]) def test_get_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -3650,7 +3630,7 @@ def test_get_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3700,10 +3680,9 @@ def test_get_view_non_empty_request_with_auto_populated_field(): client.get_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetViewRequest( + assert args[0] == logging_config.GetViewRequest( name='name_value', ) - assert args[0] == request_msg def test_get_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3772,11 +3751,7 @@ async def test_get_view_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetViewRequest({ }), - { }, -]) -async def test_get_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetViewRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3784,7 +3759,7 @@ async def test_get_view_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3810,6 +3785,11 @@ async def test_get_view_async(request_type, transport: str = 'grpc_asyncio'): assert response.description == 'description_value' assert response.filter == 'filter_value' + +@pytest.mark.asyncio +async def test_get_view_async_from_dict(): + await test_get_view_async(request_type=dict) + def test_get_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3874,10 +3854,8 @@ async def test_get_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateViewRequest({ - }), - { - }, + logging_config.CreateViewRequest, + dict, ]) def test_create_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -3887,7 +3865,7 @@ def test_create_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3938,11 +3916,10 @@ def test_create_view_non_empty_request_with_auto_populated_field(): client.create_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateViewRequest( + assert args[0] == logging_config.CreateViewRequest( parent='parent_value', view_id='view_id_value', ) - assert args[0] == request_msg def test_create_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4011,11 +3988,7 @@ async def test_create_view_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateViewRequest({ }), - { }, -]) -async def test_create_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateViewRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4023,7 +3996,7 @@ async def test_create_view_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4049,6 +4022,11 @@ async def test_create_view_async(request_type, transport: str = 'grpc_asyncio'): assert response.description == 'description_value' assert response.filter == 'filter_value' + +@pytest.mark.asyncio +async def test_create_view_async_from_dict(): + await test_create_view_async(request_type=dict) + def test_create_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4113,10 +4091,8 @@ async def test_create_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateViewRequest({ - }), - { - }, + logging_config.UpdateViewRequest, + dict, ]) def test_update_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -4126,7 +4102,7 @@ def test_update_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4176,10 +4152,9 @@ def test_update_view_non_empty_request_with_auto_populated_field(): client.update_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateViewRequest( + assert args[0] == logging_config.UpdateViewRequest( name='name_value', ) - assert args[0] == request_msg def test_update_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4248,11 +4223,7 @@ async def test_update_view_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateViewRequest({ }), - { }, -]) -async def test_update_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateViewRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4260,7 +4231,7 @@ async def test_update_view_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4286,6 +4257,11 @@ async def test_update_view_async(request_type, transport: str = 'grpc_asyncio'): assert response.description == 'description_value' assert response.filter == 'filter_value' + +@pytest.mark.asyncio +async def test_update_view_async_from_dict(): + await test_update_view_async(request_type=dict) + def test_update_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4350,10 +4326,8 @@ async def test_update_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteViewRequest({ - }), - { - }, + logging_config.DeleteViewRequest, + dict, ]) def test_delete_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -4363,7 +4337,7 @@ def test_delete_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4406,10 +4380,9 @@ def test_delete_view_non_empty_request_with_auto_populated_field(): client.delete_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteViewRequest( + assert args[0] == logging_config.DeleteViewRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4478,11 +4451,7 @@ async def test_delete_view_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteViewRequest({ }), - { }, -]) -async def test_delete_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteViewRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4490,7 +4459,7 @@ async def test_delete_view_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4509,6 +4478,11 @@ async def test_delete_view_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_view_async_from_dict(): + await test_delete_view_async(request_type=dict) + def test_delete_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4573,10 +4547,8 @@ async def test_delete_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListSinksRequest({ - }), - { - }, + logging_config.ListSinksRequest, + dict, ]) def test_list_sinks(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -4586,7 +4558,7 @@ def test_list_sinks(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4633,11 +4605,10 @@ def test_list_sinks_non_empty_request_with_auto_populated_field(): client.list_sinks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListSinksRequest( + assert args[0] == logging_config.ListSinksRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_sinks_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4706,11 +4677,7 @@ async def test_list_sinks_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListSinksRequest({ }), - { }, -]) -async def test_list_sinks_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_sinks_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListSinksRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4718,7 +4685,7 @@ async def test_list_sinks_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4740,6 +4707,11 @@ async def test_list_sinks_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListSinksAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_sinks_async_from_dict(): + await test_list_sinks_async(request_type=dict) + def test_list_sinks_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5080,10 +5052,8 @@ async def test_list_sinks_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetSinkRequest({ - }), - { - }, + logging_config.GetSinkRequest, + dict, ]) def test_get_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -5093,7 +5063,7 @@ def test_get_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5153,10 +5123,9 @@ def test_get_sink_non_empty_request_with_auto_populated_field(): client.get_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetSinkRequest( + assert args[0] == logging_config.GetSinkRequest( sink_name='sink_name_value', ) - assert args[0] == request_msg def test_get_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5225,11 +5194,7 @@ async def test_get_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetSinkRequest({ }), - { }, -]) -async def test_get_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5237,7 +5202,7 @@ async def test_get_sink_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5273,6 +5238,11 @@ async def test_get_sink_async(request_type, transport: str = 'grpc_asyncio'): assert response.writer_identity == 'writer_identity_value' assert response.include_children is True + +@pytest.mark.asyncio +async def test_get_sink_async_from_dict(): + await test_get_sink_async(request_type=dict) + def test_get_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5419,10 +5389,8 @@ async def test_get_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateSinkRequest({ - }), - { - }, + logging_config.CreateSinkRequest, + dict, ]) def test_create_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -5432,7 +5400,7 @@ def test_create_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5492,10 +5460,9 @@ def test_create_sink_non_empty_request_with_auto_populated_field(): client.create_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateSinkRequest( + assert args[0] == logging_config.CreateSinkRequest( parent='parent_value', ) - assert args[0] == request_msg def test_create_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5564,11 +5531,7 @@ async def test_create_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateSinkRequest({ }), - { }, -]) -async def test_create_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateSinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5576,7 +5539,7 @@ async def test_create_sink_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5612,6 +5575,11 @@ async def test_create_sink_async(request_type, transport: str = 'grpc_asyncio'): assert response.writer_identity == 'writer_identity_value' assert response.include_children is True + +@pytest.mark.asyncio +async def test_create_sink_async_from_dict(): + await test_create_sink_async(request_type=dict) + def test_create_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5768,10 +5736,8 @@ async def test_create_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSinkRequest({ - }), - { - }, + logging_config.UpdateSinkRequest, + dict, ]) def test_update_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -5781,7 +5747,7 @@ def test_update_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5841,10 +5807,9 @@ def test_update_sink_non_empty_request_with_auto_populated_field(): client.update_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateSinkRequest( + assert args[0] == logging_config.UpdateSinkRequest( sink_name='sink_name_value', ) - assert args[0] == request_msg def test_update_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5913,11 +5878,7 @@ async def test_update_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateSinkRequest({ }), - { }, -]) -async def test_update_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5925,7 +5886,7 @@ async def test_update_sink_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5961,6 +5922,11 @@ async def test_update_sink_async(request_type, transport: str = 'grpc_asyncio'): assert response.writer_identity == 'writer_identity_value' assert response.include_children is True + +@pytest.mark.asyncio +async def test_update_sink_async_from_dict(): + await test_update_sink_async(request_type=dict) + def test_update_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6127,10 +6093,8 @@ async def test_update_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteSinkRequest({ - }), - { - }, + logging_config.DeleteSinkRequest, + dict, ]) def test_delete_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -6140,7 +6104,7 @@ def test_delete_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6183,10 +6147,9 @@ def test_delete_sink_non_empty_request_with_auto_populated_field(): client.delete_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteSinkRequest( + assert args[0] == logging_config.DeleteSinkRequest( sink_name='sink_name_value', ) - assert args[0] == request_msg def test_delete_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6255,11 +6218,7 @@ async def test_delete_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteSinkRequest({ }), - { }, -]) -async def test_delete_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteSinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6267,7 +6226,7 @@ async def test_delete_sink_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6286,6 +6245,11 @@ async def test_delete_sink_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_sink_async_from_dict(): + await test_delete_sink_async(request_type=dict) + def test_delete_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6432,10 +6396,8 @@ async def test_delete_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateLinkRequest({ - }), - { - }, + logging_config.CreateLinkRequest, + dict, ]) def test_create_link(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -6445,7 +6407,7 @@ def test_create_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6489,11 +6451,10 @@ def test_create_link_non_empty_request_with_auto_populated_field(): client.create_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateLinkRequest( + assert args[0] == logging_config.CreateLinkRequest( parent='parent_value', link_id='link_id_value', ) - assert args[0] == request_msg def test_create_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6572,11 +6533,7 @@ async def test_create_link_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateLinkRequest({ }), - { }, -]) -async def test_create_link_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateLinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6584,7 +6541,7 @@ async def test_create_link_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6605,6 +6562,11 @@ async def test_create_link_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_link_async_from_dict(): + await test_create_link_async(request_type=dict) + def test_create_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6773,10 +6735,8 @@ async def test_create_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteLinkRequest({ - }), - { - }, + logging_config.DeleteLinkRequest, + dict, ]) def test_delete_link(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -6786,7 +6746,7 @@ def test_delete_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6829,10 +6789,9 @@ def test_delete_link_non_empty_request_with_auto_populated_field(): client.delete_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteLinkRequest( + assert args[0] == logging_config.DeleteLinkRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6911,11 +6870,7 @@ async def test_delete_link_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteLinkRequest({ }), - { }, -]) -async def test_delete_link_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteLinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6923,7 +6878,7 @@ async def test_delete_link_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6944,6 +6899,11 @@ async def test_delete_link_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_link_async_from_dict(): + await test_delete_link_async(request_type=dict) + def test_delete_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7092,10 +7052,8 @@ async def test_delete_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListLinksRequest({ - }), - { - }, + logging_config.ListLinksRequest, + dict, ]) def test_list_links(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -7105,7 +7063,7 @@ def test_list_links(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7152,11 +7110,10 @@ def test_list_links_non_empty_request_with_auto_populated_field(): client.list_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListLinksRequest( + assert args[0] == logging_config.ListLinksRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_links_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7225,11 +7182,7 @@ async def test_list_links_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListLinksRequest({ }), - { }, -]) -async def test_list_links_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_links_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListLinksRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7237,7 +7190,7 @@ async def test_list_links_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7259,6 +7212,11 @@ async def test_list_links_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListLinksAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_links_async_from_dict(): + await test_list_links_async(request_type=dict) + def test_list_links_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7599,10 +7557,8 @@ async def test_list_links_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetLinkRequest({ - }), - { - }, + logging_config.GetLinkRequest, + dict, ]) def test_get_link(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -7612,7 +7568,7 @@ def test_get_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7662,10 +7618,9 @@ def test_get_link_non_empty_request_with_auto_populated_field(): client.get_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetLinkRequest( + assert args[0] == logging_config.GetLinkRequest( name='name_value', ) - assert args[0] == request_msg def test_get_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7734,11 +7689,7 @@ async def test_get_link_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetLinkRequest({ }), - { }, -]) -async def test_get_link_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetLinkRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7746,7 +7697,7 @@ async def test_get_link_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7772,6 +7723,11 @@ async def test_get_link_async(request_type, transport: str = 'grpc_asyncio'): assert response.description == 'description_value' assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE + +@pytest.mark.asyncio +async def test_get_link_async_from_dict(): + await test_get_link_async(request_type=dict) + def test_get_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7918,10 +7874,8 @@ async def test_get_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListExclusionsRequest({ - }), - { - }, + logging_config.ListExclusionsRequest, + dict, ]) def test_list_exclusions(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -7931,7 +7885,7 @@ def test_list_exclusions(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7978,11 +7932,10 @@ def test_list_exclusions_non_empty_request_with_auto_populated_field(): client.list_exclusions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListExclusionsRequest( + assert args[0] == logging_config.ListExclusionsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_exclusions_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8051,11 +8004,7 @@ async def test_list_exclusions_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListExclusionsRequest({ }), - { }, -]) -async def test_list_exclusions_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_exclusions_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListExclusionsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8063,7 +8012,7 @@ async def test_list_exclusions_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8085,6 +8034,11 @@ async def test_list_exclusions_async(request_type, transport: str = 'grpc_asynci assert isinstance(response, pagers.ListExclusionsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_exclusions_async_from_dict(): + await test_list_exclusions_async(request_type=dict) + def test_list_exclusions_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8425,10 +8379,8 @@ async def test_list_exclusions_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetExclusionRequest({ - }), - { - }, + logging_config.GetExclusionRequest, + dict, ]) def test_get_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -8438,7 +8390,7 @@ def test_get_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8490,10 +8442,9 @@ def test_get_exclusion_non_empty_request_with_auto_populated_field(): client.get_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetExclusionRequest( + assert args[0] == logging_config.GetExclusionRequest( name='name_value', ) - assert args[0] == request_msg def test_get_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8562,11 +8513,7 @@ async def test_get_exclusion_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetExclusionRequest({ }), - { }, -]) -async def test_get_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetExclusionRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8574,7 +8521,7 @@ async def test_get_exclusion_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8602,6 +8549,11 @@ async def test_get_exclusion_async(request_type, transport: str = 'grpc_asyncio' assert response.filter == 'filter_value' assert response.disabled is True + +@pytest.mark.asyncio +async def test_get_exclusion_async_from_dict(): + await test_get_exclusion_async(request_type=dict) + def test_get_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8748,10 +8700,8 @@ async def test_get_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateExclusionRequest({ - }), - { - }, + logging_config.CreateExclusionRequest, + dict, ]) def test_create_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -8761,7 +8711,7 @@ def test_create_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8813,10 +8763,9 @@ def test_create_exclusion_non_empty_request_with_auto_populated_field(): client.create_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateExclusionRequest( + assert args[0] == logging_config.CreateExclusionRequest( parent='parent_value', ) - assert args[0] == request_msg def test_create_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8885,11 +8834,7 @@ async def test_create_exclusion_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateExclusionRequest({ }), - { }, -]) -async def test_create_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateExclusionRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8897,7 +8842,7 @@ async def test_create_exclusion_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8925,6 +8870,11 @@ async def test_create_exclusion_async(request_type, transport: str = 'grpc_async assert response.filter == 'filter_value' assert response.disabled is True + +@pytest.mark.asyncio +async def test_create_exclusion_async_from_dict(): + await test_create_exclusion_async(request_type=dict) + def test_create_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9081,10 +9031,8 @@ async def test_create_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateExclusionRequest({ - }), - { - }, + logging_config.UpdateExclusionRequest, + dict, ]) def test_update_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9094,7 +9042,7 @@ def test_update_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9146,10 +9094,9 @@ def test_update_exclusion_non_empty_request_with_auto_populated_field(): client.update_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateExclusionRequest( + assert args[0] == logging_config.UpdateExclusionRequest( name='name_value', ) - assert args[0] == request_msg def test_update_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9218,11 +9165,7 @@ async def test_update_exclusion_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateExclusionRequest({ }), - { }, -]) -async def test_update_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateExclusionRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9230,7 +9173,7 @@ async def test_update_exclusion_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9258,6 +9201,11 @@ async def test_update_exclusion_async(request_type, transport: str = 'grpc_async assert response.filter == 'filter_value' assert response.disabled is True + +@pytest.mark.asyncio +async def test_update_exclusion_async_from_dict(): + await test_update_exclusion_async(request_type=dict) + def test_update_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9424,10 +9372,8 @@ async def test_update_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteExclusionRequest({ - }), - { - }, + logging_config.DeleteExclusionRequest, + dict, ]) def test_delete_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9437,7 +9383,7 @@ def test_delete_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9480,10 +9426,9 @@ def test_delete_exclusion_non_empty_request_with_auto_populated_field(): client.delete_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteExclusionRequest( + assert args[0] == logging_config.DeleteExclusionRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9552,11 +9497,7 @@ async def test_delete_exclusion_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteExclusionRequest({ }), - { }, -]) -async def test_delete_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteExclusionRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9564,7 +9505,7 @@ async def test_delete_exclusion_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9583,6 +9524,11 @@ async def test_delete_exclusion_async(request_type, transport: str = 'grpc_async # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_exclusion_async_from_dict(): + await test_delete_exclusion_async(request_type=dict) + def test_delete_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9729,10 +9675,8 @@ async def test_delete_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetCmekSettingsRequest({ - }), - { - }, + logging_config.GetCmekSettingsRequest, + dict, ]) def test_get_cmek_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9742,7 +9686,7 @@ def test_get_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9794,10 +9738,9 @@ def test_get_cmek_settings_non_empty_request_with_auto_populated_field(): client.get_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetCmekSettingsRequest( + assert args[0] == logging_config.GetCmekSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test_get_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9866,11 +9809,7 @@ async def test_get_cmek_settings_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetCmekSettingsRequest({ }), - { }, -]) -async def test_get_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetCmekSettingsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9878,7 +9817,7 @@ async def test_get_cmek_settings_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9906,6 +9845,11 @@ async def test_get_cmek_settings_async(request_type, transport: str = 'grpc_asyn assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' + +@pytest.mark.asyncio +async def test_get_cmek_settings_async_from_dict(): + await test_get_cmek_settings_async(request_type=dict) + def test_get_cmek_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9970,10 +9914,8 @@ async def test_get_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateCmekSettingsRequest({ - }), - { - }, + logging_config.UpdateCmekSettingsRequest, + dict, ]) def test_update_cmek_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9983,7 +9925,7 @@ def test_update_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10035,10 +9977,9 @@ def test_update_cmek_settings_non_empty_request_with_auto_populated_field(): client.update_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateCmekSettingsRequest( + assert args[0] == logging_config.UpdateCmekSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test_update_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10107,11 +10048,7 @@ async def test_update_cmek_settings_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateCmekSettingsRequest({ }), - { }, -]) -async def test_update_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateCmekSettingsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10119,7 +10056,7 @@ async def test_update_cmek_settings_async(request_type, transport: str = 'grpc_a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10147,6 +10084,11 @@ async def test_update_cmek_settings_async(request_type, transport: str = 'grpc_a assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' + +@pytest.mark.asyncio +async def test_update_cmek_settings_async_from_dict(): + await test_update_cmek_settings_async(request_type=dict) + def test_update_cmek_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10211,10 +10153,8 @@ async def test_update_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetSettingsRequest({ - }), - { - }, + logging_config.GetSettingsRequest, + dict, ]) def test_get_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -10224,7 +10164,7 @@ def test_get_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10278,10 +10218,9 @@ def test_get_settings_non_empty_request_with_auto_populated_field(): client.get_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetSettingsRequest( + assert args[0] == logging_config.GetSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test_get_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10350,11 +10289,7 @@ async def test_get_settings_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetSettingsRequest({ }), - { }, -]) -async def test_get_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSettingsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10362,7 +10297,7 @@ async def test_get_settings_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10392,6 +10327,11 @@ async def test_get_settings_async(request_type, transport: str = 'grpc_asyncio') assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True + +@pytest.mark.asyncio +async def test_get_settings_async_from_dict(): + await test_get_settings_async(request_type=dict) + def test_get_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10538,10 +10478,8 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSettingsRequest({ - }), - { - }, + logging_config.UpdateSettingsRequest, + dict, ]) def test_update_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -10551,7 +10489,7 @@ def test_update_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10605,10 +10543,9 @@ def test_update_settings_non_empty_request_with_auto_populated_field(): client.update_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateSettingsRequest( + assert args[0] == logging_config.UpdateSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test_update_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10677,11 +10614,7 @@ async def test_update_settings_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateSettingsRequest({ }), - { }, -]) -async def test_update_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSettingsRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10689,7 +10622,7 @@ async def test_update_settings_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10719,6 +10652,11 @@ async def test_update_settings_async(request_type, transport: str = 'grpc_asynci assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True + +@pytest.mark.asyncio +async def test_update_settings_async_from_dict(): + await test_update_settings_async(request_type=dict) + def test_update_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10875,10 +10813,8 @@ async def test_update_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CopyLogEntriesRequest({ - }), - { - }, + logging_config.CopyLogEntriesRequest, + dict, ]) def test_copy_log_entries(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -10888,7 +10824,7 @@ def test_copy_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10933,12 +10869,11 @@ def test_copy_log_entries_non_empty_request_with_auto_populated_field(): client.copy_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CopyLogEntriesRequest( + assert args[0] == logging_config.CopyLogEntriesRequest( name='name_value', filter='filter_value', destination='destination_value', ) - assert args[0] == request_msg def test_copy_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11017,11 +10952,7 @@ async def test_copy_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CopyLogEntriesRequest({ }), - { }, -]) -async def test_copy_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_copy_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging_config.CopyLogEntriesRequest): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11029,7 +10960,7 @@ async def test_copy_log_entries_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11051,6 +10982,11 @@ async def test_copy_log_entries_async(request_type, transport: str = 'grpc_async assert isinstance(response, future.Future) +@pytest.mark.asyncio +async def test_copy_log_entries_async_from_dict(): + await test_copy_log_entries_async(request_type=dict) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ConfigServiceV2GrpcTransport( @@ -11171,6 +11107,7 @@ def test_list_buckets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() + assert args[0] == request_msg @@ -11193,6 +11130,7 @@ def test_get_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() + assert args[0] == request_msg @@ -11215,6 +11153,7 @@ def test_create_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -11237,6 +11176,7 @@ def test_update_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -11259,6 +11199,7 @@ def test_create_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -11281,6 +11222,7 @@ def test_update_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -11303,6 +11245,7 @@ def test_delete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() + assert args[0] == request_msg @@ -11325,6 +11268,7 @@ def test_undelete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() + assert args[0] == request_msg @@ -11347,6 +11291,7 @@ def test_list_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() + assert args[0] == request_msg @@ -11369,6 +11314,7 @@ def test_get_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() + assert args[0] == request_msg @@ -11391,6 +11337,7 @@ def test_create_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() + assert args[0] == request_msg @@ -11413,6 +11360,7 @@ def test_update_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() + assert args[0] == request_msg @@ -11435,6 +11383,7 @@ def test_delete_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() + assert args[0] == request_msg @@ -11457,6 +11406,7 @@ def test_list_sinks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() + assert args[0] == request_msg @@ -11479,6 +11429,7 @@ def test_get_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() + assert args[0] == request_msg @@ -11501,6 +11452,7 @@ def test_create_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() + assert args[0] == request_msg @@ -11523,6 +11475,7 @@ def test_update_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() + assert args[0] == request_msg @@ -11545,6 +11498,7 @@ def test_delete_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() + assert args[0] == request_msg @@ -11567,6 +11521,7 @@ def test_create_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() + assert args[0] == request_msg @@ -11589,6 +11544,7 @@ def test_delete_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() + assert args[0] == request_msg @@ -11611,6 +11567,7 @@ def test_list_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() + assert args[0] == request_msg @@ -11633,6 +11590,7 @@ def test_get_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() + assert args[0] == request_msg @@ -11655,6 +11613,7 @@ def test_list_exclusions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() + assert args[0] == request_msg @@ -11677,6 +11636,7 @@ def test_get_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() + assert args[0] == request_msg @@ -11699,6 +11659,7 @@ def test_create_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() + assert args[0] == request_msg @@ -11721,6 +11682,7 @@ def test_update_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() + assert args[0] == request_msg @@ -11743,6 +11705,7 @@ def test_delete_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() + assert args[0] == request_msg @@ -11765,6 +11728,7 @@ def test_get_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() + assert args[0] == request_msg @@ -11787,6 +11751,7 @@ def test_update_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() + assert args[0] == request_msg @@ -11809,6 +11774,7 @@ def test_get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() + assert args[0] == request_msg @@ -11831,6 +11797,7 @@ def test_update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() + assert args[0] == request_msg @@ -11853,6 +11820,7 @@ def test_copy_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() + assert args[0] == request_msg @@ -11894,6 +11862,7 @@ async def test_list_buckets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() + assert args[0] == request_msg @@ -11926,6 +11895,7 @@ async def test_get_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() + assert args[0] == request_msg @@ -11952,6 +11922,7 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -11978,6 +11949,7 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -12010,6 +11982,7 @@ async def test_create_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -12042,6 +12015,7 @@ async def test_update_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -12066,6 +12040,7 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() + assert args[0] == request_msg @@ -12090,6 +12065,7 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() + assert args[0] == request_msg @@ -12116,6 +12092,7 @@ async def test_list_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() + assert args[0] == request_msg @@ -12144,6 +12121,7 @@ async def test_get_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() + assert args[0] == request_msg @@ -12172,6 +12150,7 @@ async def test_create_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() + assert args[0] == request_msg @@ -12200,6 +12179,7 @@ async def test_update_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() + assert args[0] == request_msg @@ -12224,6 +12204,7 @@ async def test_delete_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() + assert args[0] == request_msg @@ -12250,6 +12231,7 @@ async def test_list_sinks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() + assert args[0] == request_msg @@ -12283,6 +12265,7 @@ async def test_get_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() + assert args[0] == request_msg @@ -12316,6 +12299,7 @@ async def test_create_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() + assert args[0] == request_msg @@ -12349,6 +12333,7 @@ async def test_update_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() + assert args[0] == request_msg @@ -12373,6 +12358,7 @@ async def test_delete_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() + assert args[0] == request_msg @@ -12399,6 +12385,7 @@ async def test_create_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() + assert args[0] == request_msg @@ -12425,6 +12412,7 @@ async def test_delete_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() + assert args[0] == request_msg @@ -12451,6 +12439,7 @@ async def test_list_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() + assert args[0] == request_msg @@ -12479,6 +12468,7 @@ async def test_get_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() + assert args[0] == request_msg @@ -12505,6 +12495,7 @@ async def test_list_exclusions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() + assert args[0] == request_msg @@ -12534,6 +12525,7 @@ async def test_get_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() + assert args[0] == request_msg @@ -12563,6 +12555,7 @@ async def test_create_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() + assert args[0] == request_msg @@ -12592,6 +12585,7 @@ async def test_update_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() + assert args[0] == request_msg @@ -12616,6 +12610,7 @@ async def test_delete_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() + assert args[0] == request_msg @@ -12645,6 +12640,7 @@ async def test_get_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() + assert args[0] == request_msg @@ -12674,6 +12670,7 @@ async def test_update_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() + assert args[0] == request_msg @@ -12704,6 +12701,7 @@ async def test_get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() + assert args[0] == request_msg @@ -12734,6 +12732,7 @@ async def test_update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() + assert args[0] == request_msg @@ -12760,6 +12759,7 @@ async def test_copy_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 380fafa006a1..d7afda5d42ba 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -946,10 +946,8 @@ def test_logging_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging.DeleteLogRequest({ - }), - { - }, + logging.DeleteLogRequest, + dict, ]) def test_delete_log(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -959,7 +957,7 @@ def test_delete_log(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1002,10 +1000,9 @@ def test_delete_log_non_empty_request_with_auto_populated_field(): client.delete_log(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.DeleteLogRequest( + assert args[0] == logging.DeleteLogRequest( log_name='log_name_value', ) - assert args[0] == request_msg def test_delete_log_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1074,11 +1071,7 @@ async def test_delete_log_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.DeleteLogRequest({ }), - { }, -]) -async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=logging.DeleteLogRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1086,7 +1079,7 @@ async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1105,6 +1098,11 @@ async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_log_async_from_dict(): + await test_delete_log_async(request_type=dict) + def test_delete_log_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1251,10 +1249,8 @@ async def test_delete_log_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.WriteLogEntriesRequest({ - }), - { - }, + logging.WriteLogEntriesRequest, + dict, ]) def test_write_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1264,7 +1260,7 @@ def test_write_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1308,10 +1304,9 @@ def test_write_log_entries_non_empty_request_with_auto_populated_field(): client.write_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.WriteLogEntriesRequest( + assert args[0] == logging.WriteLogEntriesRequest( log_name='log_name_value', ) - assert args[0] == request_msg def test_write_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1380,11 +1375,7 @@ async def test_write_log_entries_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.WriteLogEntriesRequest({ }), - { }, -]) -async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.WriteLogEntriesRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1392,7 +1383,7 @@ async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1413,6 +1404,11 @@ async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyn assert isinstance(response, logging.WriteLogEntriesResponse) +@pytest.mark.asyncio +async def test_write_log_entries_async_from_dict(): + await test_write_log_entries_async(request_type=dict) + + def test_write_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1526,10 +1522,8 @@ async def test_write_log_entries_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.ListLogEntriesRequest({ - }), - { - }, + logging.ListLogEntriesRequest, + dict, ]) def test_list_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1539,7 +1533,7 @@ def test_list_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1587,12 +1581,11 @@ def test_list_log_entries_non_empty_request_with_auto_populated_field(): client.list_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.ListLogEntriesRequest( + assert args[0] == logging.ListLogEntriesRequest( filter='filter_value', order_by='order_by_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1661,11 +1654,7 @@ async def test_list_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.ListLogEntriesRequest({ }), - { }, -]) -async def test_list_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogEntriesRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1673,7 +1662,7 @@ async def test_list_log_entries_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1696,6 +1685,11 @@ async def test_list_log_entries_async(request_type, transport: str = 'grpc_async assert response.next_page_token == 'next_page_token_value' +@pytest.mark.asyncio +async def test_list_log_entries_async_from_dict(): + await test_list_log_entries_async(request_type=dict) + + def test_list_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1988,10 +1982,8 @@ async def test_list_log_entries_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListMonitoredResourceDescriptorsRequest({ - }), - { - }, + logging.ListMonitoredResourceDescriptorsRequest, + dict, ]) def test_list_monitored_resource_descriptors(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2001,7 +1993,7 @@ def test_list_monitored_resource_descriptors(request_type, transport: str = 'grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2047,10 +2039,9 @@ def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populat client.list_monitored_resource_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.ListMonitoredResourceDescriptorsRequest( + assert args[0] == logging.ListMonitoredResourceDescriptorsRequest( page_token='page_token_value', ) - assert args[0] == request_msg def test_list_monitored_resource_descriptors_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2119,11 +2110,7 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.ListMonitoredResourceDescriptorsRequest({ }), - { }, -]) -async def test_list_monitored_resource_descriptors_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_asyncio', request_type=logging.ListMonitoredResourceDescriptorsRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2131,7 +2118,7 @@ async def test_list_monitored_resource_descriptors_async(request_type, transport # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2154,6 +2141,11 @@ async def test_list_monitored_resource_descriptors_async(request_type, transport assert response.next_page_token == 'next_page_token_value' +@pytest.mark.asyncio +async def test_list_monitored_resource_descriptors_async_from_dict(): + await test_list_monitored_resource_descriptors_async(request_type=dict) + + def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc"): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2344,10 +2336,8 @@ async def test_list_monitored_resource_descriptors_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListLogsRequest({ - }), - { - }, + logging.ListLogsRequest, + dict, ]) def test_list_logs(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2357,7 +2347,7 @@ def test_list_logs(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2406,11 +2396,10 @@ def test_list_logs_non_empty_request_with_auto_populated_field(): client.list_logs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.ListLogsRequest( + assert args[0] == logging.ListLogsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_logs_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2479,11 +2468,7 @@ async def test_list_logs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.ListLogsRequest({ }), - { }, -]) -async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogsRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2491,7 +2476,7 @@ async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2515,6 +2500,11 @@ async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): assert response.log_names == ['log_names_value'] assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_logs_async_from_dict(): + await test_list_logs_async(request_type=dict) + def test_list_logs_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2855,10 +2845,8 @@ async def test_list_logs_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.TailLogEntriesRequest({ - }), - { - }, + logging.TailLogEntriesRequest, + dict, ]) def test_tail_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2868,7 +2856,7 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2888,6 +2876,7 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): for message in response: assert isinstance(message, logging.TailLogEntriesResponse) + def test_tail_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2955,11 +2944,7 @@ async def test_tail_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.TailLogEntriesRequest({ }), - { }, -]) -async def test_tail_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.TailLogEntriesRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2967,7 +2952,7 @@ async def test_tail_log_entries_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2989,6 +2974,11 @@ async def test_tail_log_entries_async(request_type, transport: str = 'grpc_async assert isinstance(message, logging.TailLogEntriesResponse) +@pytest.mark.asyncio +async def test_tail_log_entries_async_from_dict(): + await test_tail_log_entries_async(request_type=dict) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LoggingServiceV2GrpcTransport( @@ -3109,6 +3099,7 @@ def test_delete_log_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() + assert args[0] == request_msg @@ -3131,6 +3122,7 @@ def test_write_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() + assert args[0] == request_msg @@ -3153,6 +3145,7 @@ def test_list_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() + assert args[0] == request_msg @@ -3175,6 +3168,7 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() + assert args[0] == request_msg @@ -3197,6 +3191,7 @@ def test_list_logs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() + assert args[0] == request_msg @@ -3236,6 +3231,7 @@ async def test_delete_log_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() + assert args[0] == request_msg @@ -3261,6 +3257,7 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() + assert args[0] == request_msg @@ -3287,6 +3284,7 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() + assert args[0] == request_msg @@ -3313,6 +3311,7 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() + assert args[0] == request_msg @@ -3340,6 +3339,7 @@ async def test_list_logs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index d9cd47627b2b..f5ff8608ef45 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -944,10 +944,8 @@ def test_metrics_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging_metrics.ListLogMetricsRequest({ - }), - { - }, + logging_metrics.ListLogMetricsRequest, + dict, ]) def test_list_log_metrics(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -957,7 +955,7 @@ def test_list_log_metrics(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1004,11 +1002,10 @@ def test_list_log_metrics_non_empty_request_with_auto_populated_field(): client.list_log_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.ListLogMetricsRequest( + assert args[0] == logging_metrics.ListLogMetricsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_log_metrics_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1077,11 +1074,7 @@ async def test_list_log_metrics_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.ListLogMetricsRequest({ }), - { }, -]) -async def test_list_log_metrics_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_log_metrics_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.ListLogMetricsRequest): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1089,7 +1082,7 @@ async def test_list_log_metrics_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1111,6 +1104,11 @@ async def test_list_log_metrics_async(request_type, transport: str = 'grpc_async assert isinstance(response, pagers.ListLogMetricsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_log_metrics_async_from_dict(): + await test_list_log_metrics_async(request_type=dict) + def test_list_log_metrics_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1451,10 +1449,8 @@ async def test_list_log_metrics_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_metrics.GetLogMetricRequest({ - }), - { - }, + logging_metrics.GetLogMetricRequest, + dict, ]) def test_get_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -1464,7 +1460,7 @@ def test_get_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1522,10 +1518,9 @@ def test_get_log_metric_non_empty_request_with_auto_populated_field(): client.get_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.GetLogMetricRequest( + assert args[0] == logging_metrics.GetLogMetricRequest( metric_name='metric_name_value', ) - assert args[0] == request_msg def test_get_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1594,11 +1589,7 @@ async def test_get_log_metric_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.GetLogMetricRequest({ }), - { }, -]) -async def test_get_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.GetLogMetricRequest): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1606,7 +1597,7 @@ async def test_get_log_metric_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1640,6 +1631,11 @@ async def test_get_log_metric_async(request_type, transport: str = 'grpc_asyncio assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 + +@pytest.mark.asyncio +async def test_get_log_metric_async_from_dict(): + await test_get_log_metric_async(request_type=dict) + def test_get_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1786,10 +1782,8 @@ async def test_get_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.CreateLogMetricRequest({ - }), - { - }, + logging_metrics.CreateLogMetricRequest, + dict, ]) def test_create_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -1799,7 +1793,7 @@ def test_create_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1857,10 +1851,9 @@ def test_create_log_metric_non_empty_request_with_auto_populated_field(): client.create_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.CreateLogMetricRequest( + assert args[0] == logging_metrics.CreateLogMetricRequest( parent='parent_value', ) - assert args[0] == request_msg def test_create_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1929,11 +1922,7 @@ async def test_create_log_metric_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.CreateLogMetricRequest({ }), - { }, -]) -async def test_create_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.CreateLogMetricRequest): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1941,7 +1930,7 @@ async def test_create_log_metric_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1975,6 +1964,11 @@ async def test_create_log_metric_async(request_type, transport: str = 'grpc_asyn assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 + +@pytest.mark.asyncio +async def test_create_log_metric_async_from_dict(): + await test_create_log_metric_async(request_type=dict) + def test_create_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2131,10 +2125,8 @@ async def test_create_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.UpdateLogMetricRequest({ - }), - { - }, + logging_metrics.UpdateLogMetricRequest, + dict, ]) def test_update_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -2144,7 +2136,7 @@ def test_update_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2202,10 +2194,9 @@ def test_update_log_metric_non_empty_request_with_auto_populated_field(): client.update_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.UpdateLogMetricRequest( + assert args[0] == logging_metrics.UpdateLogMetricRequest( metric_name='metric_name_value', ) - assert args[0] == request_msg def test_update_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2274,11 +2265,7 @@ async def test_update_log_metric_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.UpdateLogMetricRequest({ }), - { }, -]) -async def test_update_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.UpdateLogMetricRequest): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2286,7 +2273,7 @@ async def test_update_log_metric_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2320,6 +2307,11 @@ async def test_update_log_metric_async(request_type, transport: str = 'grpc_asyn assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 + +@pytest.mark.asyncio +async def test_update_log_metric_async_from_dict(): + await test_update_log_metric_async(request_type=dict) + def test_update_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2476,10 +2468,8 @@ async def test_update_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.DeleteLogMetricRequest({ - }), - { - }, + logging_metrics.DeleteLogMetricRequest, + dict, ]) def test_delete_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -2489,7 +2479,7 @@ def test_delete_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2532,10 +2522,9 @@ def test_delete_log_metric_non_empty_request_with_auto_populated_field(): client.delete_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.DeleteLogMetricRequest( + assert args[0] == logging_metrics.DeleteLogMetricRequest( metric_name='metric_name_value', ) - assert args[0] == request_msg def test_delete_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2604,11 +2593,7 @@ async def test_delete_log_metric_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.DeleteLogMetricRequest({ }), - { }, -]) -async def test_delete_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.DeleteLogMetricRequest): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2616,7 +2601,7 @@ async def test_delete_log_metric_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2635,6 +2620,11 @@ async def test_delete_log_metric_async(request_type, transport: str = 'grpc_asyn # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_log_metric_async_from_dict(): + await test_delete_log_metric_async(request_type=dict) + def test_delete_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2900,6 +2890,7 @@ def test_list_log_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() + assert args[0] == request_msg @@ -2922,6 +2913,7 @@ def test_get_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() + assert args[0] == request_msg @@ -2944,6 +2936,7 @@ def test_create_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() + assert args[0] == request_msg @@ -2966,6 +2959,7 @@ def test_update_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() + assert args[0] == request_msg @@ -2988,6 +2982,7 @@ def test_delete_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() + assert args[0] == request_msg @@ -3029,6 +3024,7 @@ async def test_list_log_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() + assert args[0] == request_msg @@ -3061,6 +3057,7 @@ async def test_get_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() + assert args[0] == request_msg @@ -3093,6 +3090,7 @@ async def test_create_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() + assert args[0] == request_msg @@ -3125,6 +3123,7 @@ async def test_update_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() + assert args[0] == request_msg @@ -3149,6 +3148,7 @@ async def test_delete_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py index 116ef7e2a7c0..e65cb64a539c 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -944,10 +944,8 @@ def test_base_config_service_v2_client_create_channel_credentials_file(client_cl @pytest.mark.parametrize("request_type", [ - logging_config.ListBucketsRequest({ - }), - { - }, + logging_config.ListBucketsRequest, + dict, ]) def test_list_buckets(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -957,7 +955,7 @@ def test_list_buckets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1004,11 +1002,10 @@ def test_list_buckets_non_empty_request_with_auto_populated_field(): client.list_buckets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListBucketsRequest( + assert args[0] == logging_config.ListBucketsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_buckets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1077,11 +1074,7 @@ async def test_list_buckets_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListBucketsRequest({ }), - { }, -]) -async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListBucketsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1089,7 +1082,7 @@ async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1111,6 +1104,11 @@ async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio') assert isinstance(response, pagers.ListBucketsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_buckets_async_from_dict(): + await test_list_buckets_async(request_type=dict) + def test_list_buckets_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1451,10 +1449,8 @@ async def test_list_buckets_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetBucketRequest({ - }), - { - }, + logging_config.GetBucketRequest, + dict, ]) def test_get_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -1464,7 +1460,7 @@ def test_get_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1522,10 +1518,9 @@ def test_get_bucket_non_empty_request_with_auto_populated_field(): client.get_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetBucketRequest( + assert args[0] == logging_config.GetBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_get_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1594,11 +1589,7 @@ async def test_get_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetBucketRequest({ }), - { }, -]) -async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1606,7 +1597,7 @@ async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1640,6 +1631,11 @@ async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] + +@pytest.mark.asyncio +async def test_get_bucket_async_from_dict(): + await test_get_bucket_async(request_type=dict) + def test_get_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1704,10 +1700,8 @@ async def test_get_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ - }), - { - }, + logging_config.CreateBucketRequest, + dict, ]) def test_create_bucket_async(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -1717,7 +1711,7 @@ def test_create_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1761,11 +1755,10 @@ def test_create_bucket_async_non_empty_request_with_auto_populated_field(): client.create_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateBucketRequest( + assert args[0] == logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) - assert args[0] == request_msg def test_create_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1844,11 +1837,7 @@ async def test_create_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ }), - { }, -]) -async def test_create_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1856,7 +1845,7 @@ async def test_create_bucket_async_async(request_type, transport: str = 'grpc_as # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1877,6 +1866,11 @@ async def test_create_bucket_async_async(request_type, transport: str = 'grpc_as # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_bucket_async_async_from_dict(): + await test_create_bucket_async_async(request_type=dict) + def test_create_bucket_async_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1941,10 +1935,8 @@ async def test_create_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ - }), - { - }, + logging_config.UpdateBucketRequest, + dict, ]) def test_update_bucket_async(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -1954,7 +1946,7 @@ def test_update_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1997,10 +1989,9 @@ def test_update_bucket_async_non_empty_request_with_auto_populated_field(): client.update_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateBucketRequest( + assert args[0] == logging_config.UpdateBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_update_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2079,11 +2070,7 @@ async def test_update_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ }), - { }, -]) -async def test_update_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2091,7 +2078,7 @@ async def test_update_bucket_async_async(request_type, transport: str = 'grpc_as # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2112,6 +2099,11 @@ async def test_update_bucket_async_async(request_type, transport: str = 'grpc_as # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_bucket_async_async_from_dict(): + await test_update_bucket_async_async(request_type=dict) + def test_update_bucket_async_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2176,10 +2168,8 @@ async def test_update_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ - }), - { - }, + logging_config.CreateBucketRequest, + dict, ]) def test_create_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2189,7 +2179,7 @@ def test_create_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2248,11 +2238,10 @@ def test_create_bucket_non_empty_request_with_auto_populated_field(): client.create_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateBucketRequest( + assert args[0] == logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) - assert args[0] == request_msg def test_create_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2321,11 +2310,7 @@ async def test_create_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest({ }), - { }, -]) -async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2333,7 +2318,7 @@ async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2367,6 +2352,11 @@ async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio' assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] + +@pytest.mark.asyncio +async def test_create_bucket_async_from_dict(): + await test_create_bucket_async(request_type=dict) + def test_create_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2431,10 +2421,8 @@ async def test_create_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ - }), - { - }, + logging_config.UpdateBucketRequest, + dict, ]) def test_update_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2444,7 +2432,7 @@ def test_update_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2502,10 +2490,9 @@ def test_update_bucket_non_empty_request_with_auto_populated_field(): client.update_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateBucketRequest( + assert args[0] == logging_config.UpdateBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_update_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2574,11 +2561,7 @@ async def test_update_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest({ }), - { }, -]) -async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2586,7 +2569,7 @@ async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2620,6 +2603,11 @@ async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio' assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] + +@pytest.mark.asyncio +async def test_update_bucket_async_from_dict(): + await test_update_bucket_async(request_type=dict) + def test_update_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2684,10 +2672,8 @@ async def test_update_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteBucketRequest({ - }), - { - }, + logging_config.DeleteBucketRequest, + dict, ]) def test_delete_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2697,7 +2683,7 @@ def test_delete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2740,10 +2726,9 @@ def test_delete_bucket_non_empty_request_with_auto_populated_field(): client.delete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteBucketRequest( + assert args[0] == logging_config.DeleteBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2812,11 +2797,7 @@ async def test_delete_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteBucketRequest({ }), - { }, -]) -async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2824,7 +2805,7 @@ async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2843,6 +2824,11 @@ async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio' # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_bucket_async_from_dict(): + await test_delete_bucket_async(request_type=dict) + def test_delete_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2907,10 +2893,8 @@ async def test_delete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UndeleteBucketRequest({ - }), - { - }, + logging_config.UndeleteBucketRequest, + dict, ]) def test_undelete_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2920,7 +2904,7 @@ def test_undelete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2963,10 +2947,9 @@ def test_undelete_bucket_non_empty_request_with_auto_populated_field(): client.undelete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UndeleteBucketRequest( + assert args[0] == logging_config.UndeleteBucketRequest( name='name_value', ) - assert args[0] == request_msg def test_undelete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3035,11 +3018,7 @@ async def test_undelete_bucket_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UndeleteBucketRequest({ }), - { }, -]) -async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asyncio'): +async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UndeleteBucketRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3047,7 +3026,7 @@ async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3066,6 +3045,11 @@ async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_undelete_bucket_async_from_dict(): + await test_undelete_bucket_async(request_type=dict) + def test_undelete_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3130,10 +3114,8 @@ async def test_undelete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListViewsRequest({ - }), - { - }, + logging_config.ListViewsRequest, + dict, ]) def test__list_views(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -3143,7 +3125,7 @@ def test__list_views(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3190,11 +3172,10 @@ def test__list_views_non_empty_request_with_auto_populated_field(): client._list_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListViewsRequest( + assert args[0] == logging_config.ListViewsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test__list_views_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3263,11 +3244,7 @@ async def test__list_views_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListViewsRequest({ }), - { }, -]) -async def test__list_views_async(request_type, transport: str = 'grpc_asyncio'): +async def test__list_views_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListViewsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3275,7 +3252,7 @@ async def test__list_views_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3297,6 +3274,11 @@ async def test__list_views_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListViewsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test__list_views_async_from_dict(): + await test__list_views_async(request_type=dict) + def test__list_views_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3637,10 +3619,8 @@ async def test__list_views_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetViewRequest({ - }), - { - }, + logging_config.GetViewRequest, + dict, ]) def test__get_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -3650,7 +3630,7 @@ def test__get_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3700,10 +3680,9 @@ def test__get_view_non_empty_request_with_auto_populated_field(): client._get_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetViewRequest( + assert args[0] == logging_config.GetViewRequest( name='name_value', ) - assert args[0] == request_msg def test__get_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3772,11 +3751,7 @@ async def test__get_view_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetViewRequest({ }), - { }, -]) -async def test__get_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetViewRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3784,7 +3759,7 @@ async def test__get_view_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3810,6 +3785,11 @@ async def test__get_view_async(request_type, transport: str = 'grpc_asyncio'): assert response.description == 'description_value' assert response.filter == 'filter_value' + +@pytest.mark.asyncio +async def test__get_view_async_from_dict(): + await test__get_view_async(request_type=dict) + def test__get_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3874,10 +3854,8 @@ async def test__get_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateViewRequest({ - }), - { - }, + logging_config.CreateViewRequest, + dict, ]) def test__create_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -3887,7 +3865,7 @@ def test__create_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3938,11 +3916,10 @@ def test__create_view_non_empty_request_with_auto_populated_field(): client._create_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateViewRequest( + assert args[0] == logging_config.CreateViewRequest( parent='parent_value', view_id='view_id_value', ) - assert args[0] == request_msg def test__create_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4011,11 +3988,7 @@ async def test__create_view_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateViewRequest({ }), - { }, -]) -async def test__create_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test__create_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateViewRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4023,7 +3996,7 @@ async def test__create_view_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4049,6 +4022,11 @@ async def test__create_view_async(request_type, transport: str = 'grpc_asyncio') assert response.description == 'description_value' assert response.filter == 'filter_value' + +@pytest.mark.asyncio +async def test__create_view_async_from_dict(): + await test__create_view_async(request_type=dict) + def test__create_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4113,10 +4091,8 @@ async def test__create_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateViewRequest({ - }), - { - }, + logging_config.UpdateViewRequest, + dict, ]) def test__update_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -4126,7 +4102,7 @@ def test__update_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4176,10 +4152,9 @@ def test__update_view_non_empty_request_with_auto_populated_field(): client._update_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateViewRequest( + assert args[0] == logging_config.UpdateViewRequest( name='name_value', ) - assert args[0] == request_msg def test__update_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4248,11 +4223,7 @@ async def test__update_view_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateViewRequest({ }), - { }, -]) -async def test__update_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test__update_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateViewRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4260,7 +4231,7 @@ async def test__update_view_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4286,6 +4257,11 @@ async def test__update_view_async(request_type, transport: str = 'grpc_asyncio') assert response.description == 'description_value' assert response.filter == 'filter_value' + +@pytest.mark.asyncio +async def test__update_view_async_from_dict(): + await test__update_view_async(request_type=dict) + def test__update_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4350,10 +4326,8 @@ async def test__update_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteViewRequest({ - }), - { - }, + logging_config.DeleteViewRequest, + dict, ]) def test__delete_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -4363,7 +4337,7 @@ def test__delete_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4406,10 +4380,9 @@ def test__delete_view_non_empty_request_with_auto_populated_field(): client._delete_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteViewRequest( + assert args[0] == logging_config.DeleteViewRequest( name='name_value', ) - assert args[0] == request_msg def test__delete_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4478,11 +4451,7 @@ async def test__delete_view_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteViewRequest({ }), - { }, -]) -async def test__delete_view_async(request_type, transport: str = 'grpc_asyncio'): +async def test__delete_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteViewRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4490,7 +4459,7 @@ async def test__delete_view_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4509,6 +4478,11 @@ async def test__delete_view_async(request_type, transport: str = 'grpc_asyncio') # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test__delete_view_async_from_dict(): + await test__delete_view_async(request_type=dict) + def test__delete_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4573,10 +4547,8 @@ async def test__delete_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListSinksRequest({ - }), - { - }, + logging_config.ListSinksRequest, + dict, ]) def test__list_sinks(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -4586,7 +4558,7 @@ def test__list_sinks(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4633,11 +4605,10 @@ def test__list_sinks_non_empty_request_with_auto_populated_field(): client._list_sinks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListSinksRequest( + assert args[0] == logging_config.ListSinksRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test__list_sinks_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4706,11 +4677,7 @@ async def test__list_sinks_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListSinksRequest({ }), - { }, -]) -async def test__list_sinks_async(request_type, transport: str = 'grpc_asyncio'): +async def test__list_sinks_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListSinksRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4718,7 +4685,7 @@ async def test__list_sinks_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4740,6 +4707,11 @@ async def test__list_sinks_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListSinksAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test__list_sinks_async_from_dict(): + await test__list_sinks_async(request_type=dict) + def test__list_sinks_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5080,10 +5052,8 @@ async def test__list_sinks_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetSinkRequest({ - }), - { - }, + logging_config.GetSinkRequest, + dict, ]) def test__get_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -5093,7 +5063,7 @@ def test__get_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5153,10 +5123,9 @@ def test__get_sink_non_empty_request_with_auto_populated_field(): client._get_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetSinkRequest( + assert args[0] == logging_config.GetSinkRequest( sink_name='sink_name_value', ) - assert args[0] == request_msg def test__get_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5225,11 +5194,7 @@ async def test__get_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetSinkRequest({ }), - { }, -]) -async def test__get_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5237,7 +5202,7 @@ async def test__get_sink_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5273,6 +5238,11 @@ async def test__get_sink_async(request_type, transport: str = 'grpc_asyncio'): assert response.writer_identity == 'writer_identity_value' assert response.include_children is True + +@pytest.mark.asyncio +async def test__get_sink_async_from_dict(): + await test__get_sink_async(request_type=dict) + def test__get_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5419,10 +5389,8 @@ async def test__get_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateSinkRequest({ - }), - { - }, + logging_config.CreateSinkRequest, + dict, ]) def test__create_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -5432,7 +5400,7 @@ def test__create_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5492,10 +5460,9 @@ def test__create_sink_non_empty_request_with_auto_populated_field(): client._create_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateSinkRequest( + assert args[0] == logging_config.CreateSinkRequest( parent='parent_value', ) - assert args[0] == request_msg def test__create_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5564,11 +5531,7 @@ async def test__create_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateSinkRequest({ }), - { }, -]) -async def test__create_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test__create_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateSinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5576,7 +5539,7 @@ async def test__create_sink_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5612,6 +5575,11 @@ async def test__create_sink_async(request_type, transport: str = 'grpc_asyncio') assert response.writer_identity == 'writer_identity_value' assert response.include_children is True + +@pytest.mark.asyncio +async def test__create_sink_async_from_dict(): + await test__create_sink_async(request_type=dict) + def test__create_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5768,10 +5736,8 @@ async def test__create_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSinkRequest({ - }), - { - }, + logging_config.UpdateSinkRequest, + dict, ]) def test__update_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -5781,7 +5747,7 @@ def test__update_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5841,10 +5807,9 @@ def test__update_sink_non_empty_request_with_auto_populated_field(): client._update_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateSinkRequest( + assert args[0] == logging_config.UpdateSinkRequest( sink_name='sink_name_value', ) - assert args[0] == request_msg def test__update_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5913,11 +5878,7 @@ async def test__update_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateSinkRequest({ }), - { }, -]) -async def test__update_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test__update_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5925,7 +5886,7 @@ async def test__update_sink_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5961,6 +5922,11 @@ async def test__update_sink_async(request_type, transport: str = 'grpc_asyncio') assert response.writer_identity == 'writer_identity_value' assert response.include_children is True + +@pytest.mark.asyncio +async def test__update_sink_async_from_dict(): + await test__update_sink_async(request_type=dict) + def test__update_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6127,10 +6093,8 @@ async def test__update_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteSinkRequest({ - }), - { - }, + logging_config.DeleteSinkRequest, + dict, ]) def test__delete_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -6140,7 +6104,7 @@ def test__delete_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6183,10 +6147,9 @@ def test__delete_sink_non_empty_request_with_auto_populated_field(): client._delete_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteSinkRequest( + assert args[0] == logging_config.DeleteSinkRequest( sink_name='sink_name_value', ) - assert args[0] == request_msg def test__delete_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6255,11 +6218,7 @@ async def test__delete_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteSinkRequest({ }), - { }, -]) -async def test__delete_sink_async(request_type, transport: str = 'grpc_asyncio'): +async def test__delete_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteSinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6267,7 +6226,7 @@ async def test__delete_sink_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6286,6 +6245,11 @@ async def test__delete_sink_async(request_type, transport: str = 'grpc_asyncio') # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test__delete_sink_async_from_dict(): + await test__delete_sink_async(request_type=dict) + def test__delete_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6432,10 +6396,8 @@ async def test__delete_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateLinkRequest({ - }), - { - }, + logging_config.CreateLinkRequest, + dict, ]) def test__create_link(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -6445,7 +6407,7 @@ def test__create_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6489,11 +6451,10 @@ def test__create_link_non_empty_request_with_auto_populated_field(): client._create_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateLinkRequest( + assert args[0] == logging_config.CreateLinkRequest( parent='parent_value', link_id='link_id_value', ) - assert args[0] == request_msg def test__create_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6572,11 +6533,7 @@ async def test__create_link_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateLinkRequest({ }), - { }, -]) -async def test__create_link_async(request_type, transport: str = 'grpc_asyncio'): +async def test__create_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateLinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6584,7 +6541,7 @@ async def test__create_link_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6605,6 +6562,11 @@ async def test__create_link_async(request_type, transport: str = 'grpc_asyncio') # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test__create_link_async_from_dict(): + await test__create_link_async(request_type=dict) + def test__create_link_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6773,10 +6735,8 @@ async def test__create_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteLinkRequest({ - }), - { - }, + logging_config.DeleteLinkRequest, + dict, ]) def test__delete_link(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -6786,7 +6746,7 @@ def test__delete_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6829,10 +6789,9 @@ def test__delete_link_non_empty_request_with_auto_populated_field(): client._delete_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteLinkRequest( + assert args[0] == logging_config.DeleteLinkRequest( name='name_value', ) - assert args[0] == request_msg def test__delete_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6911,11 +6870,7 @@ async def test__delete_link_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteLinkRequest({ }), - { }, -]) -async def test__delete_link_async(request_type, transport: str = 'grpc_asyncio'): +async def test__delete_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteLinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6923,7 +6878,7 @@ async def test__delete_link_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6944,6 +6899,11 @@ async def test__delete_link_async(request_type, transport: str = 'grpc_asyncio') # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test__delete_link_async_from_dict(): + await test__delete_link_async(request_type=dict) + def test__delete_link_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7092,10 +7052,8 @@ async def test__delete_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListLinksRequest({ - }), - { - }, + logging_config.ListLinksRequest, + dict, ]) def test__list_links(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -7105,7 +7063,7 @@ def test__list_links(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7152,11 +7110,10 @@ def test__list_links_non_empty_request_with_auto_populated_field(): client._list_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListLinksRequest( + assert args[0] == logging_config.ListLinksRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test__list_links_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7225,11 +7182,7 @@ async def test__list_links_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListLinksRequest({ }), - { }, -]) -async def test__list_links_async(request_type, transport: str = 'grpc_asyncio'): +async def test__list_links_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListLinksRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7237,7 +7190,7 @@ async def test__list_links_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7259,6 +7212,11 @@ async def test__list_links_async(request_type, transport: str = 'grpc_asyncio'): assert isinstance(response, pagers.ListLinksAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test__list_links_async_from_dict(): + await test__list_links_async(request_type=dict) + def test__list_links_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7599,10 +7557,8 @@ async def test__list_links_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetLinkRequest({ - }), - { - }, + logging_config.GetLinkRequest, + dict, ]) def test__get_link(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -7612,7 +7568,7 @@ def test__get_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7662,10 +7618,9 @@ def test__get_link_non_empty_request_with_auto_populated_field(): client._get_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetLinkRequest( + assert args[0] == logging_config.GetLinkRequest( name='name_value', ) - assert args[0] == request_msg def test__get_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7734,11 +7689,7 @@ async def test__get_link_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetLinkRequest({ }), - { }, -]) -async def test__get_link_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetLinkRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7746,7 +7697,7 @@ async def test__get_link_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7772,6 +7723,11 @@ async def test__get_link_async(request_type, transport: str = 'grpc_asyncio'): assert response.description == 'description_value' assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE + +@pytest.mark.asyncio +async def test__get_link_async_from_dict(): + await test__get_link_async(request_type=dict) + def test__get_link_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7918,10 +7874,8 @@ async def test__get_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListExclusionsRequest({ - }), - { - }, + logging_config.ListExclusionsRequest, + dict, ]) def test__list_exclusions(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -7931,7 +7885,7 @@ def test__list_exclusions(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7978,11 +7932,10 @@ def test__list_exclusions_non_empty_request_with_auto_populated_field(): client._list_exclusions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.ListExclusionsRequest( + assert args[0] == logging_config.ListExclusionsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test__list_exclusions_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8051,11 +8004,7 @@ async def test__list_exclusions_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.ListExclusionsRequest({ }), - { }, -]) -async def test__list_exclusions_async(request_type, transport: str = 'grpc_asyncio'): +async def test__list_exclusions_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListExclusionsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8063,7 +8012,7 @@ async def test__list_exclusions_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8085,6 +8034,11 @@ async def test__list_exclusions_async(request_type, transport: str = 'grpc_async assert isinstance(response, pagers.ListExclusionsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test__list_exclusions_async_from_dict(): + await test__list_exclusions_async(request_type=dict) + def test__list_exclusions_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8425,10 +8379,8 @@ async def test__list_exclusions_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetExclusionRequest({ - }), - { - }, + logging_config.GetExclusionRequest, + dict, ]) def test__get_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -8438,7 +8390,7 @@ def test__get_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8490,10 +8442,9 @@ def test__get_exclusion_non_empty_request_with_auto_populated_field(): client._get_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetExclusionRequest( + assert args[0] == logging_config.GetExclusionRequest( name='name_value', ) - assert args[0] == request_msg def test__get_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8562,11 +8513,7 @@ async def test__get_exclusion_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetExclusionRequest({ }), - { }, -]) -async def test__get_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetExclusionRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8574,7 +8521,7 @@ async def test__get_exclusion_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8602,6 +8549,11 @@ async def test__get_exclusion_async(request_type, transport: str = 'grpc_asyncio assert response.filter == 'filter_value' assert response.disabled is True + +@pytest.mark.asyncio +async def test__get_exclusion_async_from_dict(): + await test__get_exclusion_async(request_type=dict) + def test__get_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8748,10 +8700,8 @@ async def test__get_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateExclusionRequest({ - }), - { - }, + logging_config.CreateExclusionRequest, + dict, ]) def test__create_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -8761,7 +8711,7 @@ def test__create_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8813,10 +8763,9 @@ def test__create_exclusion_non_empty_request_with_auto_populated_field(): client._create_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CreateExclusionRequest( + assert args[0] == logging_config.CreateExclusionRequest( parent='parent_value', ) - assert args[0] == request_msg def test__create_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8885,11 +8834,7 @@ async def test__create_exclusion_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CreateExclusionRequest({ }), - { }, -]) -async def test__create_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test__create_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateExclusionRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8897,7 +8842,7 @@ async def test__create_exclusion_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8925,6 +8870,11 @@ async def test__create_exclusion_async(request_type, transport: str = 'grpc_asyn assert response.filter == 'filter_value' assert response.disabled is True + +@pytest.mark.asyncio +async def test__create_exclusion_async_from_dict(): + await test__create_exclusion_async(request_type=dict) + def test__create_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9081,10 +9031,8 @@ async def test__create_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateExclusionRequest({ - }), - { - }, + logging_config.UpdateExclusionRequest, + dict, ]) def test__update_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9094,7 +9042,7 @@ def test__update_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9146,10 +9094,9 @@ def test__update_exclusion_non_empty_request_with_auto_populated_field(): client._update_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateExclusionRequest( + assert args[0] == logging_config.UpdateExclusionRequest( name='name_value', ) - assert args[0] == request_msg def test__update_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9218,11 +9165,7 @@ async def test__update_exclusion_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateExclusionRequest({ }), - { }, -]) -async def test__update_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test__update_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateExclusionRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9230,7 +9173,7 @@ async def test__update_exclusion_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9258,6 +9201,11 @@ async def test__update_exclusion_async(request_type, transport: str = 'grpc_asyn assert response.filter == 'filter_value' assert response.disabled is True + +@pytest.mark.asyncio +async def test__update_exclusion_async_from_dict(): + await test__update_exclusion_async(request_type=dict) + def test__update_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9424,10 +9372,8 @@ async def test__update_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteExclusionRequest({ - }), - { - }, + logging_config.DeleteExclusionRequest, + dict, ]) def test__delete_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9437,7 +9383,7 @@ def test__delete_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9480,10 +9426,9 @@ def test__delete_exclusion_non_empty_request_with_auto_populated_field(): client._delete_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.DeleteExclusionRequest( + assert args[0] == logging_config.DeleteExclusionRequest( name='name_value', ) - assert args[0] == request_msg def test__delete_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9552,11 +9497,7 @@ async def test__delete_exclusion_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.DeleteExclusionRequest({ }), - { }, -]) -async def test__delete_exclusion_async(request_type, transport: str = 'grpc_asyncio'): +async def test__delete_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteExclusionRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9564,7 +9505,7 @@ async def test__delete_exclusion_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9583,6 +9524,11 @@ async def test__delete_exclusion_async(request_type, transport: str = 'grpc_asyn # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test__delete_exclusion_async_from_dict(): + await test__delete_exclusion_async(request_type=dict) + def test__delete_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9729,10 +9675,8 @@ async def test__delete_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetCmekSettingsRequest({ - }), - { - }, + logging_config.GetCmekSettingsRequest, + dict, ]) def test__get_cmek_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9742,7 +9686,7 @@ def test__get_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9794,10 +9738,9 @@ def test__get_cmek_settings_non_empty_request_with_auto_populated_field(): client._get_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetCmekSettingsRequest( + assert args[0] == logging_config.GetCmekSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test__get_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9866,11 +9809,7 @@ async def test__get_cmek_settings_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetCmekSettingsRequest({ }), - { }, -]) -async def test__get_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetCmekSettingsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9878,7 +9817,7 @@ async def test__get_cmek_settings_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9906,6 +9845,11 @@ async def test__get_cmek_settings_async(request_type, transport: str = 'grpc_asy assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' + +@pytest.mark.asyncio +async def test__get_cmek_settings_async_from_dict(): + await test__get_cmek_settings_async(request_type=dict) + def test__get_cmek_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9970,10 +9914,8 @@ async def test__get_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateCmekSettingsRequest({ - }), - { - }, + logging_config.UpdateCmekSettingsRequest, + dict, ]) def test__update_cmek_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9983,7 +9925,7 @@ def test__update_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10035,10 +9977,9 @@ def test__update_cmek_settings_non_empty_request_with_auto_populated_field(): client._update_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateCmekSettingsRequest( + assert args[0] == logging_config.UpdateCmekSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test__update_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10107,11 +10048,7 @@ async def test__update_cmek_settings_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateCmekSettingsRequest({ }), - { }, -]) -async def test__update_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test__update_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateCmekSettingsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10119,7 +10056,7 @@ async def test__update_cmek_settings_async(request_type, transport: str = 'grpc_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10147,6 +10084,11 @@ async def test__update_cmek_settings_async(request_type, transport: str = 'grpc_ assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' + +@pytest.mark.asyncio +async def test__update_cmek_settings_async_from_dict(): + await test__update_cmek_settings_async(request_type=dict) + def test__update_cmek_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10211,10 +10153,8 @@ async def test__update_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetSettingsRequest({ - }), - { - }, + logging_config.GetSettingsRequest, + dict, ]) def test__get_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -10224,7 +10164,7 @@ def test__get_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10278,10 +10218,9 @@ def test__get_settings_non_empty_request_with_auto_populated_field(): client._get_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.GetSettingsRequest( + assert args[0] == logging_config.GetSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test__get_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10350,11 +10289,7 @@ async def test__get_settings_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.GetSettingsRequest({ }), - { }, -]) -async def test__get_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSettingsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10362,7 +10297,7 @@ async def test__get_settings_async(request_type, transport: str = 'grpc_asyncio' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10392,6 +10327,11 @@ async def test__get_settings_async(request_type, transport: str = 'grpc_asyncio' assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True + +@pytest.mark.asyncio +async def test__get_settings_async_from_dict(): + await test__get_settings_async(request_type=dict) + def test__get_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10538,10 +10478,8 @@ async def test__get_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSettingsRequest({ - }), - { - }, + logging_config.UpdateSettingsRequest, + dict, ]) def test__update_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -10551,7 +10489,7 @@ def test__update_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10605,10 +10543,9 @@ def test__update_settings_non_empty_request_with_auto_populated_field(): client._update_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.UpdateSettingsRequest( + assert args[0] == logging_config.UpdateSettingsRequest( name='name_value', ) - assert args[0] == request_msg def test__update_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10677,11 +10614,7 @@ async def test__update_settings_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.UpdateSettingsRequest({ }), - { }, -]) -async def test__update_settings_async(request_type, transport: str = 'grpc_asyncio'): +async def test__update_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSettingsRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10689,7 +10622,7 @@ async def test__update_settings_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10719,6 +10652,11 @@ async def test__update_settings_async(request_type, transport: str = 'grpc_async assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True + +@pytest.mark.asyncio +async def test__update_settings_async_from_dict(): + await test__update_settings_async(request_type=dict) + def test__update_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10875,10 +10813,8 @@ async def test__update_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CopyLogEntriesRequest({ - }), - { - }, + logging_config.CopyLogEntriesRequest, + dict, ]) def test__copy_log_entries(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -10888,7 +10824,7 @@ def test__copy_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10933,12 +10869,11 @@ def test__copy_log_entries_non_empty_request_with_auto_populated_field(): client._copy_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_config.CopyLogEntriesRequest( + assert args[0] == logging_config.CopyLogEntriesRequest( name='name_value', filter='filter_value', destination='destination_value', ) - assert args[0] == request_msg def test__copy_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11017,11 +10952,7 @@ async def test__copy_log_entries_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_config.CopyLogEntriesRequest({ }), - { }, -]) -async def test__copy_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test__copy_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging_config.CopyLogEntriesRequest): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11029,7 +10960,7 @@ async def test__copy_log_entries_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11051,6 +10982,11 @@ async def test__copy_log_entries_async(request_type, transport: str = 'grpc_asyn assert isinstance(response, future.Future) +@pytest.mark.asyncio +async def test__copy_log_entries_async_from_dict(): + await test__copy_log_entries_async(request_type=dict) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ConfigServiceV2GrpcTransport( @@ -11171,6 +11107,7 @@ def test_list_buckets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() + assert args[0] == request_msg @@ -11193,6 +11130,7 @@ def test_get_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() + assert args[0] == request_msg @@ -11215,6 +11153,7 @@ def test_create_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -11237,6 +11176,7 @@ def test_update_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -11259,6 +11199,7 @@ def test_create_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -11281,6 +11222,7 @@ def test_update_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -11303,6 +11245,7 @@ def test_delete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() + assert args[0] == request_msg @@ -11325,6 +11268,7 @@ def test_undelete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() + assert args[0] == request_msg @@ -11347,6 +11291,7 @@ def test__list_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() + assert args[0] == request_msg @@ -11369,6 +11314,7 @@ def test__get_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() + assert args[0] == request_msg @@ -11391,6 +11337,7 @@ def test__create_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() + assert args[0] == request_msg @@ -11413,6 +11360,7 @@ def test__update_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() + assert args[0] == request_msg @@ -11435,6 +11383,7 @@ def test__delete_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() + assert args[0] == request_msg @@ -11457,6 +11406,7 @@ def test__list_sinks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() + assert args[0] == request_msg @@ -11479,6 +11429,7 @@ def test__get_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() + assert args[0] == request_msg @@ -11501,6 +11452,7 @@ def test__create_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() + assert args[0] == request_msg @@ -11523,6 +11475,7 @@ def test__update_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() + assert args[0] == request_msg @@ -11545,6 +11498,7 @@ def test__delete_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() + assert args[0] == request_msg @@ -11567,6 +11521,7 @@ def test__create_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() + assert args[0] == request_msg @@ -11589,6 +11544,7 @@ def test__delete_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() + assert args[0] == request_msg @@ -11611,6 +11567,7 @@ def test__list_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() + assert args[0] == request_msg @@ -11633,6 +11590,7 @@ def test__get_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() + assert args[0] == request_msg @@ -11655,6 +11613,7 @@ def test__list_exclusions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() + assert args[0] == request_msg @@ -11677,6 +11636,7 @@ def test__get_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() + assert args[0] == request_msg @@ -11699,6 +11659,7 @@ def test__create_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() + assert args[0] == request_msg @@ -11721,6 +11682,7 @@ def test__update_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() + assert args[0] == request_msg @@ -11743,6 +11705,7 @@ def test__delete_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() + assert args[0] == request_msg @@ -11765,6 +11728,7 @@ def test__get_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() + assert args[0] == request_msg @@ -11787,6 +11751,7 @@ def test__update_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() + assert args[0] == request_msg @@ -11809,6 +11774,7 @@ def test__get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() + assert args[0] == request_msg @@ -11831,6 +11797,7 @@ def test__update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() + assert args[0] == request_msg @@ -11853,6 +11820,7 @@ def test__copy_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() + assert args[0] == request_msg @@ -11894,6 +11862,7 @@ async def test_list_buckets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() + assert args[0] == request_msg @@ -11926,6 +11895,7 @@ async def test_get_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() + assert args[0] == request_msg @@ -11952,6 +11922,7 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -11978,6 +11949,7 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -12010,6 +11982,7 @@ async def test_create_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() + assert args[0] == request_msg @@ -12042,6 +12015,7 @@ async def test_update_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() + assert args[0] == request_msg @@ -12066,6 +12040,7 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() + assert args[0] == request_msg @@ -12090,6 +12065,7 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() + assert args[0] == request_msg @@ -12116,6 +12092,7 @@ async def test__list_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() + assert args[0] == request_msg @@ -12144,6 +12121,7 @@ async def test__get_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() + assert args[0] == request_msg @@ -12172,6 +12150,7 @@ async def test__create_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() + assert args[0] == request_msg @@ -12200,6 +12179,7 @@ async def test__update_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() + assert args[0] == request_msg @@ -12224,6 +12204,7 @@ async def test__delete_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() + assert args[0] == request_msg @@ -12250,6 +12231,7 @@ async def test__list_sinks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() + assert args[0] == request_msg @@ -12283,6 +12265,7 @@ async def test__get_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() + assert args[0] == request_msg @@ -12316,6 +12299,7 @@ async def test__create_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() + assert args[0] == request_msg @@ -12349,6 +12333,7 @@ async def test__update_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() + assert args[0] == request_msg @@ -12373,6 +12358,7 @@ async def test__delete_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() + assert args[0] == request_msg @@ -12399,6 +12385,7 @@ async def test__create_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() + assert args[0] == request_msg @@ -12425,6 +12412,7 @@ async def test__delete_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() + assert args[0] == request_msg @@ -12451,6 +12439,7 @@ async def test__list_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() + assert args[0] == request_msg @@ -12479,6 +12468,7 @@ async def test__get_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() + assert args[0] == request_msg @@ -12505,6 +12495,7 @@ async def test__list_exclusions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() + assert args[0] == request_msg @@ -12534,6 +12525,7 @@ async def test__get_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() + assert args[0] == request_msg @@ -12563,6 +12555,7 @@ async def test__create_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() + assert args[0] == request_msg @@ -12592,6 +12585,7 @@ async def test__update_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() + assert args[0] == request_msg @@ -12616,6 +12610,7 @@ async def test__delete_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() + assert args[0] == request_msg @@ -12645,6 +12640,7 @@ async def test__get_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() + assert args[0] == request_msg @@ -12674,6 +12670,7 @@ async def test__update_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() + assert args[0] == request_msg @@ -12704,6 +12701,7 @@ async def test__get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() + assert args[0] == request_msg @@ -12734,6 +12732,7 @@ async def test__update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() + assert args[0] == request_msg @@ -12760,6 +12759,7 @@ async def test__copy_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 380fafa006a1..d7afda5d42ba 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -946,10 +946,8 @@ def test_logging_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging.DeleteLogRequest({ - }), - { - }, + logging.DeleteLogRequest, + dict, ]) def test_delete_log(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -959,7 +957,7 @@ def test_delete_log(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1002,10 +1000,9 @@ def test_delete_log_non_empty_request_with_auto_populated_field(): client.delete_log(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.DeleteLogRequest( + assert args[0] == logging.DeleteLogRequest( log_name='log_name_value', ) - assert args[0] == request_msg def test_delete_log_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1074,11 +1071,7 @@ async def test_delete_log_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.DeleteLogRequest({ }), - { }, -]) -async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=logging.DeleteLogRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1086,7 +1079,7 @@ async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1105,6 +1098,11 @@ async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_log_async_from_dict(): + await test_delete_log_async(request_type=dict) + def test_delete_log_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1251,10 +1249,8 @@ async def test_delete_log_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.WriteLogEntriesRequest({ - }), - { - }, + logging.WriteLogEntriesRequest, + dict, ]) def test_write_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1264,7 +1260,7 @@ def test_write_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1308,10 +1304,9 @@ def test_write_log_entries_non_empty_request_with_auto_populated_field(): client.write_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.WriteLogEntriesRequest( + assert args[0] == logging.WriteLogEntriesRequest( log_name='log_name_value', ) - assert args[0] == request_msg def test_write_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1380,11 +1375,7 @@ async def test_write_log_entries_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.WriteLogEntriesRequest({ }), - { }, -]) -async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.WriteLogEntriesRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1392,7 +1383,7 @@ async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1413,6 +1404,11 @@ async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyn assert isinstance(response, logging.WriteLogEntriesResponse) +@pytest.mark.asyncio +async def test_write_log_entries_async_from_dict(): + await test_write_log_entries_async(request_type=dict) + + def test_write_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1526,10 +1522,8 @@ async def test_write_log_entries_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.ListLogEntriesRequest({ - }), - { - }, + logging.ListLogEntriesRequest, + dict, ]) def test_list_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1539,7 +1533,7 @@ def test_list_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1587,12 +1581,11 @@ def test_list_log_entries_non_empty_request_with_auto_populated_field(): client.list_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.ListLogEntriesRequest( + assert args[0] == logging.ListLogEntriesRequest( filter='filter_value', order_by='order_by_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1661,11 +1654,7 @@ async def test_list_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.ListLogEntriesRequest({ }), - { }, -]) -async def test_list_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogEntriesRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1673,7 +1662,7 @@ async def test_list_log_entries_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1696,6 +1685,11 @@ async def test_list_log_entries_async(request_type, transport: str = 'grpc_async assert response.next_page_token == 'next_page_token_value' +@pytest.mark.asyncio +async def test_list_log_entries_async_from_dict(): + await test_list_log_entries_async(request_type=dict) + + def test_list_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1988,10 +1982,8 @@ async def test_list_log_entries_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListMonitoredResourceDescriptorsRequest({ - }), - { - }, + logging.ListMonitoredResourceDescriptorsRequest, + dict, ]) def test_list_monitored_resource_descriptors(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2001,7 +1993,7 @@ def test_list_monitored_resource_descriptors(request_type, transport: str = 'grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2047,10 +2039,9 @@ def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populat client.list_monitored_resource_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.ListMonitoredResourceDescriptorsRequest( + assert args[0] == logging.ListMonitoredResourceDescriptorsRequest( page_token='page_token_value', ) - assert args[0] == request_msg def test_list_monitored_resource_descriptors_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2119,11 +2110,7 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.ListMonitoredResourceDescriptorsRequest({ }), - { }, -]) -async def test_list_monitored_resource_descriptors_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_asyncio', request_type=logging.ListMonitoredResourceDescriptorsRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2131,7 +2118,7 @@ async def test_list_monitored_resource_descriptors_async(request_type, transport # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2154,6 +2141,11 @@ async def test_list_monitored_resource_descriptors_async(request_type, transport assert response.next_page_token == 'next_page_token_value' +@pytest.mark.asyncio +async def test_list_monitored_resource_descriptors_async_from_dict(): + await test_list_monitored_resource_descriptors_async(request_type=dict) + + def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc"): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2344,10 +2336,8 @@ async def test_list_monitored_resource_descriptors_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListLogsRequest({ - }), - { - }, + logging.ListLogsRequest, + dict, ]) def test_list_logs(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2357,7 +2347,7 @@ def test_list_logs(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2406,11 +2396,10 @@ def test_list_logs_non_empty_request_with_auto_populated_field(): client.list_logs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging.ListLogsRequest( + assert args[0] == logging.ListLogsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_logs_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2479,11 +2468,7 @@ async def test_list_logs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.ListLogsRequest({ }), - { }, -]) -async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogsRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2491,7 +2476,7 @@ async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2515,6 +2500,11 @@ async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): assert response.log_names == ['log_names_value'] assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test_list_logs_async_from_dict(): + await test_list_logs_async(request_type=dict) + def test_list_logs_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2855,10 +2845,8 @@ async def test_list_logs_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.TailLogEntriesRequest({ - }), - { - }, + logging.TailLogEntriesRequest, + dict, ]) def test_tail_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2868,7 +2856,7 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2888,6 +2876,7 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): for message in response: assert isinstance(message, logging.TailLogEntriesResponse) + def test_tail_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2955,11 +2944,7 @@ async def test_tail_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging.TailLogEntriesRequest({ }), - { }, -]) -async def test_tail_log_entries_async(request_type, transport: str = 'grpc_asyncio'): +async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.TailLogEntriesRequest): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2967,7 +2952,7 @@ async def test_tail_log_entries_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2989,6 +2974,11 @@ async def test_tail_log_entries_async(request_type, transport: str = 'grpc_async assert isinstance(message, logging.TailLogEntriesResponse) +@pytest.mark.asyncio +async def test_tail_log_entries_async_from_dict(): + await test_tail_log_entries_async(request_type=dict) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LoggingServiceV2GrpcTransport( @@ -3109,6 +3099,7 @@ def test_delete_log_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() + assert args[0] == request_msg @@ -3131,6 +3122,7 @@ def test_write_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() + assert args[0] == request_msg @@ -3153,6 +3145,7 @@ def test_list_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() + assert args[0] == request_msg @@ -3175,6 +3168,7 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() + assert args[0] == request_msg @@ -3197,6 +3191,7 @@ def test_list_logs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() + assert args[0] == request_msg @@ -3236,6 +3231,7 @@ async def test_delete_log_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() + assert args[0] == request_msg @@ -3261,6 +3257,7 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() + assert args[0] == request_msg @@ -3287,6 +3284,7 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() + assert args[0] == request_msg @@ -3313,6 +3311,7 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() + assert args[0] == request_msg @@ -3340,6 +3339,7 @@ async def test_list_logs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 987ff7bf337b..be4e396c2a3b 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -944,10 +944,8 @@ def test_base_metrics_service_v2_client_create_channel_credentials_file(client_c @pytest.mark.parametrize("request_type", [ - logging_metrics.ListLogMetricsRequest({ - }), - { - }, + logging_metrics.ListLogMetricsRequest, + dict, ]) def test__list_log_metrics(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -957,7 +955,7 @@ def test__list_log_metrics(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1004,11 +1002,10 @@ def test__list_log_metrics_non_empty_request_with_auto_populated_field(): client._list_log_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.ListLogMetricsRequest( + assert args[0] == logging_metrics.ListLogMetricsRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test__list_log_metrics_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1077,11 +1074,7 @@ async def test__list_log_metrics_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.ListLogMetricsRequest({ }), - { }, -]) -async def test__list_log_metrics_async(request_type, transport: str = 'grpc_asyncio'): +async def test__list_log_metrics_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.ListLogMetricsRequest): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1089,7 +1082,7 @@ async def test__list_log_metrics_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1111,6 +1104,11 @@ async def test__list_log_metrics_async(request_type, transport: str = 'grpc_asyn assert isinstance(response, pagers.ListLogMetricsAsyncPager) assert response.next_page_token == 'next_page_token_value' + +@pytest.mark.asyncio +async def test__list_log_metrics_async_from_dict(): + await test__list_log_metrics_async(request_type=dict) + def test__list_log_metrics_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1451,10 +1449,8 @@ async def test__list_log_metrics_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_metrics.GetLogMetricRequest({ - }), - { - }, + logging_metrics.GetLogMetricRequest, + dict, ]) def test__get_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -1464,7 +1460,7 @@ def test__get_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1522,10 +1518,9 @@ def test__get_log_metric_non_empty_request_with_auto_populated_field(): client._get_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.GetLogMetricRequest( + assert args[0] == logging_metrics.GetLogMetricRequest( metric_name='metric_name_value', ) - assert args[0] == request_msg def test__get_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1594,11 +1589,7 @@ async def test__get_log_metric_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.GetLogMetricRequest({ }), - { }, -]) -async def test__get_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test__get_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.GetLogMetricRequest): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1606,7 +1597,7 @@ async def test__get_log_metric_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1640,6 +1631,11 @@ async def test__get_log_metric_async(request_type, transport: str = 'grpc_asynci assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 + +@pytest.mark.asyncio +async def test__get_log_metric_async_from_dict(): + await test__get_log_metric_async(request_type=dict) + def test__get_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1786,10 +1782,8 @@ async def test__get_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.CreateLogMetricRequest({ - }), - { - }, + logging_metrics.CreateLogMetricRequest, + dict, ]) def test__create_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -1799,7 +1793,7 @@ def test__create_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1857,10 +1851,9 @@ def test__create_log_metric_non_empty_request_with_auto_populated_field(): client._create_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.CreateLogMetricRequest( + assert args[0] == logging_metrics.CreateLogMetricRequest( parent='parent_value', ) - assert args[0] == request_msg def test__create_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1929,11 +1922,7 @@ async def test__create_log_metric_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.CreateLogMetricRequest({ }), - { }, -]) -async def test__create_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test__create_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.CreateLogMetricRequest): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1941,7 +1930,7 @@ async def test__create_log_metric_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1975,6 +1964,11 @@ async def test__create_log_metric_async(request_type, transport: str = 'grpc_asy assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 + +@pytest.mark.asyncio +async def test__create_log_metric_async_from_dict(): + await test__create_log_metric_async(request_type=dict) + def test__create_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2131,10 +2125,8 @@ async def test__create_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.UpdateLogMetricRequest({ - }), - { - }, + logging_metrics.UpdateLogMetricRequest, + dict, ]) def test__update_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -2144,7 +2136,7 @@ def test__update_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2202,10 +2194,9 @@ def test__update_log_metric_non_empty_request_with_auto_populated_field(): client._update_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.UpdateLogMetricRequest( + assert args[0] == logging_metrics.UpdateLogMetricRequest( metric_name='metric_name_value', ) - assert args[0] == request_msg def test__update_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2274,11 +2265,7 @@ async def test__update_log_metric_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.UpdateLogMetricRequest({ }), - { }, -]) -async def test__update_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test__update_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.UpdateLogMetricRequest): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2286,7 +2273,7 @@ async def test__update_log_metric_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2320,6 +2307,11 @@ async def test__update_log_metric_async(request_type, transport: str = 'grpc_asy assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 + +@pytest.mark.asyncio +async def test__update_log_metric_async_from_dict(): + await test__update_log_metric_async(request_type=dict) + def test__update_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2476,10 +2468,8 @@ async def test__update_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.DeleteLogMetricRequest({ - }), - { - }, + logging_metrics.DeleteLogMetricRequest, + dict, ]) def test__delete_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -2489,7 +2479,7 @@ def test__delete_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2532,10 +2522,9 @@ def test__delete_log_metric_non_empty_request_with_auto_populated_field(): client._delete_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = logging_metrics.DeleteLogMetricRequest( + assert args[0] == logging_metrics.DeleteLogMetricRequest( metric_name='metric_name_value', ) - assert args[0] == request_msg def test__delete_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2604,11 +2593,7 @@ async def test__delete_log_metric_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - logging_metrics.DeleteLogMetricRequest({ }), - { }, -]) -async def test__delete_log_metric_async(request_type, transport: str = 'grpc_asyncio'): +async def test__delete_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.DeleteLogMetricRequest): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2616,7 +2601,7 @@ async def test__delete_log_metric_async(request_type, transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2635,6 +2620,11 @@ async def test__delete_log_metric_async(request_type, transport: str = 'grpc_asy # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test__delete_log_metric_async_from_dict(): + await test__delete_log_metric_async(request_type=dict) + def test__delete_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2900,6 +2890,7 @@ def test__list_log_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() + assert args[0] == request_msg @@ -2922,6 +2913,7 @@ def test__get_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() + assert args[0] == request_msg @@ -2944,6 +2936,7 @@ def test__create_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() + assert args[0] == request_msg @@ -2966,6 +2959,7 @@ def test__update_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() + assert args[0] == request_msg @@ -2988,6 +2982,7 @@ def test__delete_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() + assert args[0] == request_msg @@ -3029,6 +3024,7 @@ async def test__list_log_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() + assert args[0] == request_msg @@ -3061,6 +3057,7 @@ async def test__get_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() + assert args[0] == request_msg @@ -3093,6 +3090,7 @@ async def test__create_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() + assert args[0] == request_msg @@ -3125,6 +3123,7 @@ async def test__update_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() + assert args[0] == request_msg @@ -3149,6 +3148,7 @@ async def test__delete_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 9ad9492c3db4..bc2c0285caa3 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -973,10 +973,8 @@ def test_cloud_redis_client_create_channel_credentials_file(client_class, transp @pytest.mark.parametrize("request_type", [ - cloud_redis.ListInstancesRequest({ - }), - { - }, + cloud_redis.ListInstancesRequest, + dict, ]) def test_list_instances(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -986,7 +984,7 @@ def test_list_instances(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1035,11 +1033,10 @@ def test_list_instances_non_empty_request_with_auto_populated_field(): client.list_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.ListInstancesRequest( + assert args[0] == cloud_redis.ListInstancesRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1108,11 +1105,7 @@ async def test_list_instances_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.ListInstancesRequest({ }), - { }, -]) -async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_instances_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ListInstancesRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1120,7 +1113,7 @@ async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1144,6 +1137,11 @@ async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_instances_async_from_dict(): + await test_list_instances_async(request_type=dict) + def test_list_instances_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1484,10 +1482,8 @@ async def test_list_instances_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceRequest({ - }), - { - }, + cloud_redis.GetInstanceRequest, + dict, ]) def test_get_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1497,7 +1493,7 @@ def test_get_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1595,10 +1591,9 @@ def test_get_instance_non_empty_request_with_auto_populated_field(): client.get_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.GetInstanceRequest( + assert args[0] == cloud_redis.GetInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1667,11 +1662,7 @@ async def test_get_instance_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceRequest({ }), - { }, -]) -async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1679,7 +1670,7 @@ async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1753,6 +1744,11 @@ async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio') assert response.maintenance_version == 'maintenance_version_value' assert response.available_maintenance_versions == ['available_maintenance_versions_value'] + +@pytest.mark.asyncio +async def test_get_instance_async_from_dict(): + await test_get_instance_async(request_type=dict) + def test_get_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1899,10 +1895,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceAuthStringRequest({ - }), - { - }, + cloud_redis.GetInstanceAuthStringRequest, + dict, ]) def test_get_instance_auth_string(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1912,7 +1906,7 @@ def test_get_instance_auth_string(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1958,10 +1952,9 @@ def test_get_instance_auth_string_non_empty_request_with_auto_populated_field(): client.get_instance_auth_string(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.GetInstanceAuthStringRequest( + assert args[0] == cloud_redis.GetInstanceAuthStringRequest( name='name_value', ) - assert args[0] == request_msg def test_get_instance_auth_string_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2030,11 +2023,7 @@ async def test_get_instance_auth_string_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceAuthStringRequest({ }), - { }, -]) -async def test_get_instance_auth_string_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_instance_auth_string_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceAuthStringRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2042,7 +2031,7 @@ async def test_get_instance_auth_string_async(request_type, transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2064,6 +2053,11 @@ async def test_get_instance_auth_string_async(request_type, transport: str = 'gr assert isinstance(response, cloud_redis.InstanceAuthString) assert response.auth_string == 'auth_string_value' + +@pytest.mark.asyncio +async def test_get_instance_auth_string_async_from_dict(): + await test_get_instance_auth_string_async(request_type=dict) + def test_get_instance_auth_string_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2210,10 +2204,8 @@ async def test_get_instance_auth_string_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.CreateInstanceRequest({ - }), - { - }, + cloud_redis.CreateInstanceRequest, + dict, ]) def test_create_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2223,7 +2215,7 @@ def test_create_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2267,11 +2259,10 @@ def test_create_instance_non_empty_request_with_auto_populated_field(): client.create_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.CreateInstanceRequest( + assert args[0] == cloud_redis.CreateInstanceRequest( parent='parent_value', instance_id='instance_id_value', ) - assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2350,11 +2341,7 @@ async def test_create_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.CreateInstanceRequest({ }), - { }, -]) -async def test_create_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.CreateInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2362,7 +2349,7 @@ async def test_create_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2383,6 +2370,11 @@ async def test_create_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_instance_async_from_dict(): + await test_create_instance_async(request_type=dict) + def test_create_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2551,10 +2543,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.UpdateInstanceRequest({ - }), - { - }, + cloud_redis.UpdateInstanceRequest, + dict, ]) def test_update_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2564,7 +2554,7 @@ def test_update_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2606,9 +2596,8 @@ def test_update_instance_non_empty_request_with_auto_populated_field(): client.update_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.UpdateInstanceRequest( + assert args[0] == cloud_redis.UpdateInstanceRequest( ) - assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2687,11 +2676,7 @@ async def test_update_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.UpdateInstanceRequest({ }), - { }, -]) -async def test_update_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpdateInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2699,7 +2684,7 @@ async def test_update_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2720,6 +2705,11 @@ async def test_update_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_instance_async_from_dict(): + await test_update_instance_async(request_type=dict) + def test_update_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2878,10 +2868,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.UpgradeInstanceRequest({ - }), - { - }, + cloud_redis.UpgradeInstanceRequest, + dict, ]) def test_upgrade_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2891,7 +2879,7 @@ def test_upgrade_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2935,11 +2923,10 @@ def test_upgrade_instance_non_empty_request_with_auto_populated_field(): client.upgrade_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.UpgradeInstanceRequest( + assert args[0] == cloud_redis.UpgradeInstanceRequest( name='name_value', redis_version='redis_version_value', ) - assert args[0] == request_msg def test_upgrade_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3018,11 +3005,7 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.UpgradeInstanceRequest({ }), - { }, -]) -async def test_upgrade_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_upgrade_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpgradeInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3030,7 +3013,7 @@ async def test_upgrade_instance_async(request_type, transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3051,6 +3034,11 @@ async def test_upgrade_instance_async(request_type, transport: str = 'grpc_async # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_upgrade_instance_async_from_dict(): + await test_upgrade_instance_async(request_type=dict) + def test_upgrade_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3209,10 +3197,8 @@ async def test_upgrade_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.ImportInstanceRequest({ - }), - { - }, + cloud_redis.ImportInstanceRequest, + dict, ]) def test_import_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -3222,7 +3208,7 @@ def test_import_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3265,10 +3251,9 @@ def test_import_instance_non_empty_request_with_auto_populated_field(): client.import_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.ImportInstanceRequest( + assert args[0] == cloud_redis.ImportInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_import_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3347,11 +3332,7 @@ async def test_import_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.ImportInstanceRequest({ }), - { }, -]) -async def test_import_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_import_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ImportInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3359,7 +3340,7 @@ async def test_import_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3380,6 +3361,11 @@ async def test_import_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_import_instance_async_from_dict(): + await test_import_instance_async(request_type=dict) + def test_import_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3538,10 +3524,8 @@ async def test_import_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.ExportInstanceRequest({ - }), - { - }, + cloud_redis.ExportInstanceRequest, + dict, ]) def test_export_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -3551,7 +3535,7 @@ def test_export_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3594,10 +3578,9 @@ def test_export_instance_non_empty_request_with_auto_populated_field(): client.export_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.ExportInstanceRequest( + assert args[0] == cloud_redis.ExportInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_export_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3676,11 +3659,7 @@ async def test_export_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.ExportInstanceRequest({ }), - { }, -]) -async def test_export_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_export_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ExportInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3688,7 +3667,7 @@ async def test_export_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3709,6 +3688,11 @@ async def test_export_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_export_instance_async_from_dict(): + await test_export_instance_async(request_type=dict) + def test_export_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3867,10 +3851,8 @@ async def test_export_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.FailoverInstanceRequest({ - }), - { - }, + cloud_redis.FailoverInstanceRequest, + dict, ]) def test_failover_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -3880,7 +3862,7 @@ def test_failover_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3923,10 +3905,9 @@ def test_failover_instance_non_empty_request_with_auto_populated_field(): client.failover_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.FailoverInstanceRequest( + assert args[0] == cloud_redis.FailoverInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_failover_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4005,11 +3986,7 @@ async def test_failover_instance_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.FailoverInstanceRequest({ }), - { }, -]) -async def test_failover_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_failover_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.FailoverInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4017,7 +3994,7 @@ async def test_failover_instance_async(request_type, transport: str = 'grpc_asyn # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4038,6 +4015,11 @@ async def test_failover_instance_async(request_type, transport: str = 'grpc_asyn # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_failover_instance_async_from_dict(): + await test_failover_instance_async(request_type=dict) + def test_failover_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4196,10 +4178,8 @@ async def test_failover_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.DeleteInstanceRequest({ - }), - { - }, + cloud_redis.DeleteInstanceRequest, + dict, ]) def test_delete_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -4209,7 +4189,7 @@ def test_delete_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4252,10 +4232,9 @@ def test_delete_instance_non_empty_request_with_auto_populated_field(): client.delete_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.DeleteInstanceRequest( + assert args[0] == cloud_redis.DeleteInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4334,11 +4313,7 @@ async def test_delete_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.DeleteInstanceRequest({ }), - { }, -]) -async def test_delete_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.DeleteInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4346,7 +4321,7 @@ async def test_delete_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4367,6 +4342,11 @@ async def test_delete_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_instance_async_from_dict(): + await test_delete_instance_async(request_type=dict) + def test_delete_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4515,10 +4495,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.RescheduleMaintenanceRequest({ - }), - { - }, + cloud_redis.RescheduleMaintenanceRequest, + dict, ]) def test_reschedule_maintenance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -4528,7 +4506,7 @@ def test_reschedule_maintenance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4571,10 +4549,9 @@ def test_reschedule_maintenance_non_empty_request_with_auto_populated_field(): client.reschedule_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.RescheduleMaintenanceRequest( + assert args[0] == cloud_redis.RescheduleMaintenanceRequest( name='name_value', ) - assert args[0] == request_msg def test_reschedule_maintenance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4653,11 +4630,7 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc(transport: st assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.RescheduleMaintenanceRequest({ }), - { }, -]) -async def test_reschedule_maintenance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_reschedule_maintenance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.RescheduleMaintenanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4665,7 +4638,7 @@ async def test_reschedule_maintenance_async(request_type, transport: str = 'grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4686,6 +4659,11 @@ async def test_reschedule_maintenance_async(request_type, transport: str = 'grpc # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_reschedule_maintenance_async_from_dict(): + await test_reschedule_maintenance_async(request_type=dict) + def test_reschedule_maintenance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6891,6 +6869,7 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -6913,6 +6892,7 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -6935,6 +6915,7 @@ def test_get_instance_auth_string_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() + assert args[0] == request_msg @@ -6957,6 +6938,7 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -6979,6 +6961,7 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -7001,6 +6984,7 @@ def test_upgrade_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() + assert args[0] == request_msg @@ -7023,6 +7007,7 @@ def test_import_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() + assert args[0] == request_msg @@ -7045,6 +7030,7 @@ def test_export_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() + assert args[0] == request_msg @@ -7067,6 +7053,7 @@ def test_failover_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() + assert args[0] == request_msg @@ -7089,6 +7076,7 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -7111,6 +7099,7 @@ def test_reschedule_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() + assert args[0] == request_msg @@ -7153,6 +7142,7 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -7205,6 +7195,7 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -7231,6 +7222,7 @@ async def test_get_instance_auth_string_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() + assert args[0] == request_msg @@ -7257,6 +7249,7 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -7283,6 +7276,7 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -7309,6 +7303,7 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() + assert args[0] == request_msg @@ -7335,6 +7330,7 @@ async def test_import_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() + assert args[0] == request_msg @@ -7361,6 +7357,7 @@ async def test_export_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() + assert args[0] == request_msg @@ -7387,6 +7384,7 @@ async def test_failover_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() + assert args[0] == request_msg @@ -7413,6 +7411,7 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -7439,6 +7438,7 @@ async def test_reschedule_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() + assert args[0] == request_msg @@ -9153,6 +9153,7 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -9174,6 +9175,7 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -9195,6 +9197,7 @@ def test_get_instance_auth_string_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() + assert args[0] == request_msg @@ -9216,6 +9219,7 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -9237,6 +9241,7 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -9258,6 +9263,7 @@ def test_upgrade_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() + assert args[0] == request_msg @@ -9279,6 +9285,7 @@ def test_import_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() + assert args[0] == request_msg @@ -9300,6 +9307,7 @@ def test_export_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() + assert args[0] == request_msg @@ -9321,6 +9329,7 @@ def test_failover_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() + assert args[0] == request_msg @@ -9342,6 +9351,7 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -9363,6 +9373,7 @@ def test_reschedule_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() + assert args[0] == request_msg @@ -11199,6 +11210,7 @@ async def test_list_instances_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -11223,6 +11235,7 @@ async def test_get_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -11247,6 +11260,7 @@ async def test_get_instance_auth_string_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() + assert args[0] == request_msg @@ -11271,6 +11285,7 @@ async def test_create_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -11295,6 +11310,7 @@ async def test_update_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -11319,6 +11335,7 @@ async def test_upgrade_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() + assert args[0] == request_msg @@ -11343,6 +11360,7 @@ async def test_import_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() + assert args[0] == request_msg @@ -11367,6 +11385,7 @@ async def test_export_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() + assert args[0] == request_msg @@ -11391,6 +11410,7 @@ async def test_failover_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() + assert args[0] == request_msg @@ -11415,6 +11435,7 @@ async def test_delete_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -11439,6 +11460,7 @@ async def test_reschedule_maintenance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py index a505c3a8ca69..f6cea1dd2b5d 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -973,10 +973,8 @@ def test_cloud_redis_client_create_channel_credentials_file(client_class, transp @pytest.mark.parametrize("request_type", [ - cloud_redis.ListInstancesRequest({ - }), - { - }, + cloud_redis.ListInstancesRequest, + dict, ]) def test_list_instances(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -986,7 +984,7 @@ def test_list_instances(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1035,11 +1033,10 @@ def test_list_instances_non_empty_request_with_auto_populated_field(): client.list_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.ListInstancesRequest( + assert args[0] == cloud_redis.ListInstancesRequest( parent='parent_value', page_token='page_token_value', ) - assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1108,11 +1105,7 @@ async def test_list_instances_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.ListInstancesRequest({ }), - { }, -]) -async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_instances_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ListInstancesRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1120,7 +1113,7 @@ async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1144,6 +1137,11 @@ async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_instances_async_from_dict(): + await test_list_instances_async(request_type=dict) + def test_list_instances_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1484,10 +1482,8 @@ async def test_list_instances_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceRequest({ - }), - { - }, + cloud_redis.GetInstanceRequest, + dict, ]) def test_get_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1497,7 +1493,7 @@ def test_get_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1595,10 +1591,9 @@ def test_get_instance_non_empty_request_with_auto_populated_field(): client.get_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.GetInstanceRequest( + assert args[0] == cloud_redis.GetInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1667,11 +1662,7 @@ async def test_get_instance_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceRequest({ }), - { }, -]) -async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1679,7 +1670,7 @@ async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1753,6 +1744,11 @@ async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio') assert response.maintenance_version == 'maintenance_version_value' assert response.available_maintenance_versions == ['available_maintenance_versions_value'] + +@pytest.mark.asyncio +async def test_get_instance_async_from_dict(): + await test_get_instance_async(request_type=dict) + def test_get_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1899,10 +1895,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.CreateInstanceRequest({ - }), - { - }, + cloud_redis.CreateInstanceRequest, + dict, ]) def test_create_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1912,7 +1906,7 @@ def test_create_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1956,11 +1950,10 @@ def test_create_instance_non_empty_request_with_auto_populated_field(): client.create_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.CreateInstanceRequest( + assert args[0] == cloud_redis.CreateInstanceRequest( parent='parent_value', instance_id='instance_id_value', ) - assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2039,11 +2032,7 @@ async def test_create_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.CreateInstanceRequest({ }), - { }, -]) -async def test_create_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.CreateInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2051,7 +2040,7 @@ async def test_create_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2072,6 +2061,11 @@ async def test_create_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_instance_async_from_dict(): + await test_create_instance_async(request_type=dict) + def test_create_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2240,10 +2234,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.UpdateInstanceRequest({ - }), - { - }, + cloud_redis.UpdateInstanceRequest, + dict, ]) def test_update_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2253,7 +2245,7 @@ def test_update_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2295,9 +2287,8 @@ def test_update_instance_non_empty_request_with_auto_populated_field(): client.update_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.UpdateInstanceRequest( + assert args[0] == cloud_redis.UpdateInstanceRequest( ) - assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2376,11 +2367,7 @@ async def test_update_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.UpdateInstanceRequest({ }), - { }, -]) -async def test_update_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_update_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpdateInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2388,7 +2375,7 @@ async def test_update_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2409,6 +2396,11 @@ async def test_update_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_update_instance_async_from_dict(): + await test_update_instance_async(request_type=dict) + def test_update_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2567,10 +2559,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.DeleteInstanceRequest({ - }), - { - }, + cloud_redis.DeleteInstanceRequest, + dict, ]) def test_delete_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2580,7 +2570,7 @@ def test_delete_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2623,10 +2613,9 @@ def test_delete_instance_non_empty_request_with_auto_populated_field(): client.delete_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = cloud_redis.DeleteInstanceRequest( + assert args[0] == cloud_redis.DeleteInstanceRequest( name='name_value', ) - assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2705,11 +2694,7 @@ async def test_delete_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - cloud_redis.DeleteInstanceRequest({ }), - { }, -]) -async def test_delete_instance_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.DeleteInstanceRequest): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2717,7 +2702,7 @@ async def test_delete_instance_async(request_type, transport: str = 'grpc_asynci # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2738,6 +2723,11 @@ async def test_delete_instance_async(request_type, transport: str = 'grpc_asynci # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_delete_instance_async_from_dict(): + await test_delete_instance_async(request_type=dict) + def test_delete_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3915,6 +3905,7 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -3937,6 +3928,7 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -3959,6 +3951,7 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -3981,6 +3974,7 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -4003,6 +3997,7 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -4045,6 +4040,7 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -4097,6 +4093,7 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -4123,6 +4120,7 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -4149,6 +4147,7 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -4175,6 +4174,7 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -5278,6 +5278,7 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -5299,6 +5300,7 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -5320,6 +5322,7 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -5341,6 +5344,7 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -5362,6 +5366,7 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg @@ -6545,6 +6550,7 @@ async def test_list_instances_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() + assert args[0] == request_msg @@ -6569,6 +6575,7 @@ async def test_get_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() + assert args[0] == request_msg @@ -6593,6 +6600,7 @@ async def test_create_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() + assert args[0] == request_msg @@ -6617,6 +6625,7 @@ async def test_update_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg @@ -6641,6 +6650,7 @@ async def test_delete_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() + assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py index 6a8c312c992f..07263ddfe431 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py @@ -621,7 +621,8 @@ async def sample_create_job(): )), ) - self._client._setup_request_id(request, 'request_id', False) + if not request.request_id: + request.request_id = str(uuid.uuid4()) # Validate the universe domain. self._client._validate_universe_domain() @@ -727,7 +728,8 @@ async def sample_delete_job(): )), ) - self._client._setup_request_id(request, 'request_id', False) + if not request.request_id: + request.request_id = str(uuid.uuid4()) # Validate the universe domain. self._client._validate_universe_domain() @@ -829,7 +831,8 @@ async def sample_cancel_job(): )), ) - self._client._setup_request_id(request, 'request_id', False) + if not request.request_id: + request.request_id = str(uuid.uuid4()) # Validate the universe domain. self._client._validate_universe_domain() diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py index 628f7cfffc32..913bc14f0725 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py @@ -471,36 +471,6 @@ def _validate_universe_domain(self): # NOTE (b/349488459): universe validation is disabled until further notice. return True - @staticmethod - def _setup_request_id(request, field_name: str, is_proto3_optional: bool): - """Populate a UUID4 field in the request if it is not already set. - - Args: - request (Union[google.protobuf.message.Message, dict]): The request object. - field_name (str): The name of the field to populate. - is_proto3_optional (bool): Whether the field is proto3 optional. - """ - if isinstance(request, dict): - if is_proto3_optional: - if field_name not in request: - request[field_name] = str(uuid.uuid4()) - elif not request.get(field_name): - request[field_name] = str(uuid.uuid4()) - return - - if is_proto3_optional: - try: - # Pure protobuf messages - if not request.HasField(field_name): - setattr(request, field_name, str(uuid.uuid4())) - except (AttributeError, ValueError): - # Proto-plus messages or other objects - if field_name not in request: - setattr(request, field_name, str(uuid.uuid4())) - else: - if not getattr(request, field_name): - setattr(request, field_name, str(uuid.uuid4())) - def _add_cred_info_for_auth_errors( self, error: core_exceptions.GoogleAPICallError @@ -1035,7 +1005,8 @@ def sample_create_job(): )), ) - self._setup_request_id(request, 'request_id', False) + if not request.request_id: + request.request_id = str(uuid.uuid4()) # Validate the universe domain. self._validate_universe_domain() @@ -1140,7 +1111,8 @@ def sample_delete_job(): )), ) - self._setup_request_id(request, 'request_id', False) + if not request.request_id: + request.request_id = str(uuid.uuid4()) # Validate the universe domain. self._validate_universe_domain() @@ -1241,7 +1213,8 @@ def sample_cancel_job(): )), ) - self._setup_request_id(request, 'request_id', False) + if not request.request_id: + request.request_id = str(uuid.uuid4()) # Validate the universe domain. self._validate_universe_domain() diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index f25a28395082..9f6d000ab291 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py @@ -74,7 +74,6 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -_UUID4_RE = re.compile(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}") async def mock_async_gen(data, chunk_size=1): @@ -335,82 +334,6 @@ def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): client._add_cred_info_for_auth_errors(error) assert error.details == [] -def test__setup_request_id(): - class MockRequest: - def __init__(self, **kwargs): - for k, v in kwargs.items(): - setattr(self, k, v) - def __contains__(self, key): - return hasattr(self, key) - - class MockProtoRequest: - def __init__(self, **kwargs): - for k, v in kwargs.items(): - setattr(self, k, v) - def HasField(self, key): - return hasattr(self, key) - - # Test with proto3 optional field not in request - request = MockRequest() - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) - - # Test with proto3 optional field already in request - request = MockRequest(request_id="already_set") - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert request.request_id == "already_set" - - # Test with non-proto3 optional field empty - request = MockRequest(request_id="") - StorageBatchOperationsClient._setup_request_id(request, "request_id", False) - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) - - # Test with non-proto3 optional field already set - request = MockRequest(request_id="already_set") - StorageBatchOperationsClient._setup_request_id(request, "request_id", False) - assert request.request_id == "already_set" - - # Test with proto3 optional field not in request (MockProtoRequest) - request = MockProtoRequest() - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) - - # Test with proto3 optional field already in request (MockProtoRequest) - request = MockProtoRequest(request_id="already_set") - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert request.request_id == "already_set" - - # Test with ValueError - class MockValueErrorRequest: - def HasField(self, key): - raise ValueError("Mismatched field") - def __contains__(self, key): - return hasattr(self, key) - - request = MockValueErrorRequest() - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) - - # Test with dict and proto3 optional field not in request - request = {} - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request["request_id"]) - - # Test with dict and proto3 optional field already in request - request = {"request_id": "already_set"} - StorageBatchOperationsClient._setup_request_id(request, "request_id", True) - assert request["request_id"] == "already_set" - - # Test with dict and non-proto3 optional field empty - request = {"request_id": ""} - StorageBatchOperationsClient._setup_request_id(request, "request_id", False) - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request["request_id"]) - - # Test with dict and non-proto3 optional field already set - request = {"request_id": "already_set"} - StorageBatchOperationsClient._setup_request_id(request, "request_id", False) - assert request["request_id"] == "already_set" - @pytest.mark.parametrize("client_class,transport_name", [ (StorageBatchOperationsClient, "grpc"), (StorageBatchOperationsAsyncClient, "grpc_asyncio"), @@ -1041,10 +964,8 @@ def test_storage_batch_operations_client_create_channel_credentials_file(client_ @pytest.mark.parametrize("request_type", [ - storage_batch_operations.ListJobsRequest({ - }), - { - }, + storage_batch_operations.ListJobsRequest, + dict, ]) def test_list_jobs(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -1054,7 +975,7 @@ def test_list_jobs(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1105,13 +1026,12 @@ def test_list_jobs_non_empty_request_with_auto_populated_field(): client.list_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.ListJobsRequest( + assert args[0] == storage_batch_operations.ListJobsRequest( parent='parent_value', filter='filter_value', page_token='page_token_value', order_by='order_by_value', ) - assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1180,11 +1100,7 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.ListJobsRequest({ }), - { }, -]) -async def test_list_jobs_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_jobs_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.ListJobsRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1192,7 +1108,7 @@ async def test_list_jobs_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1216,6 +1132,11 @@ async def test_list_jobs_async(request_type, transport: str = 'grpc_asyncio'): assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_jobs_async_from_dict(): + await test_list_jobs_async(request_type=dict) + def test_list_jobs_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1556,10 +1477,8 @@ async def test_list_jobs_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - storage_batch_operations.GetJobRequest({ - }), - { - }, + storage_batch_operations.GetJobRequest, + dict, ]) def test_get_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -1569,7 +1488,7 @@ def test_get_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1623,10 +1542,9 @@ def test_get_job_non_empty_request_with_auto_populated_field(): client.get_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.GetJobRequest( + assert args[0] == storage_batch_operations.GetJobRequest( name='name_value', ) - assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1695,11 +1613,7 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.GetJobRequest({ }), - { }, -]) -async def test_get_job_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.GetJobRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1707,7 +1621,7 @@ async def test_get_job_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1737,6 +1651,11 @@ async def test_get_job_async(request_type, transport: str = 'grpc_asyncio'): assert response.dry_run is True assert response.is_multi_bucket_job is True + +@pytest.mark.asyncio +async def test_get_job_async_from_dict(): + await test_get_job_async(request_type=dict) + def test_get_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1883,12 +1802,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.CreateJobRequest({ - "request_id": "explicit value for autopopulate-able field", - }), - { - "request_id": "explicit value for autopopulate-able field", - }, + storage_batch_operations.CreateJobRequest, + dict, ]) def test_create_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -1898,7 +1813,11 @@ def test_create_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + if isinstance(request, dict): + request['request_id'] = "explicit value for autopopulate-able field" + else: + request.request_id = "explicit value for autopopulate-able field" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1943,14 +1862,14 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CreateJobRequest( + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + assert args[0] == storage_batch_operations.CreateJobRequest( parent='parent_value', job_id='job_id_value', ) - # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id - assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2029,11 +1948,7 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.CreateJobRequest({ "request_id": "explicit value for autopopulate-able field", }), - { "request_id": "explicit value for autopopulate-able field", }, -]) -async def test_create_job_async(request_type, transport: str = 'grpc_asyncio'): +async def test_create_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.CreateJobRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2041,7 +1956,11 @@ async def test_create_job_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + if isinstance(request, dict): + request['request_id'] = "explicit value for autopopulate-able field" + else: + request.request_id = "explicit value for autopopulate-able field" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2063,6 +1982,11 @@ async def test_create_job_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert isinstance(response, future.Future) + +@pytest.mark.asyncio +async def test_create_job_async_from_dict(): + await test_create_job_async(request_type=dict) + def test_create_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2231,12 +2155,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.DeleteJobRequest({ - "request_id": "explicit value for autopopulate-able field", - }), - { - "request_id": "explicit value for autopopulate-able field", - }, + storage_batch_operations.DeleteJobRequest, + dict, ]) def test_delete_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -2246,7 +2166,11 @@ def test_delete_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + if isinstance(request, dict): + request['request_id'] = "explicit value for autopopulate-able field" + else: + request.request_id = "explicit value for autopopulate-able field" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2290,13 +2214,13 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.DeleteJobRequest( + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + assert args[0] == storage_batch_operations.DeleteJobRequest( name='name_value', ) - # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id - assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2365,11 +2289,7 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.DeleteJobRequest({ "request_id": "explicit value for autopopulate-able field", }), - { "request_id": "explicit value for autopopulate-able field", }, -]) -async def test_delete_job_async(request_type, transport: str = 'grpc_asyncio'): +async def test_delete_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.DeleteJobRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2377,7 +2297,11 @@ async def test_delete_job_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + if isinstance(request, dict): + request['request_id'] = "explicit value for autopopulate-able field" + else: + request.request_id = "explicit value for autopopulate-able field" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2397,6 +2321,11 @@ async def test_delete_job_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert response is None + +@pytest.mark.asyncio +async def test_delete_job_async_from_dict(): + await test_delete_job_async(request_type=dict) + def test_delete_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2543,12 +2472,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.CancelJobRequest({ - "request_id": "explicit value for autopopulate-able field", - }), - { - "request_id": "explicit value for autopopulate-able field", - }, + storage_batch_operations.CancelJobRequest, + dict, ]) def test_cancel_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -2558,7 +2483,11 @@ def test_cancel_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + if isinstance(request, dict): + request['request_id'] = "explicit value for autopopulate-able field" + else: + request.request_id = "explicit value for autopopulate-able field" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2603,13 +2532,13 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CancelJobRequest( + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + assert args[0] == storage_batch_operations.CancelJobRequest( name='name_value', ) - # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id - assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2678,11 +2607,7 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.CancelJobRequest({ "request_id": "explicit value for autopopulate-able field", }), - { "request_id": "explicit value for autopopulate-able field", }, -]) -async def test_cancel_job_async(request_type, transport: str = 'grpc_asyncio'): +async def test_cancel_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.CancelJobRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2690,7 +2615,11 @@ async def test_cancel_job_async(request_type, transport: str = 'grpc_asyncio'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() + if isinstance(request, dict): + request['request_id'] = "explicit value for autopopulate-able field" + else: + request.request_id = "explicit value for autopopulate-able field" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2711,6 +2640,11 @@ async def test_cancel_job_async(request_type, transport: str = 'grpc_asyncio'): # Establish that the response is the type that we expect. assert isinstance(response, storage_batch_operations.CancelJobResponse) + +@pytest.mark.asyncio +async def test_cancel_job_async_from_dict(): + await test_cancel_job_async(request_type=dict) + def test_cancel_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2857,10 +2791,8 @@ async def test_cancel_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.ListBucketOperationsRequest({ - }), - { - }, + storage_batch_operations.ListBucketOperationsRequest, + dict, ]) def test_list_bucket_operations(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -2870,7 +2802,7 @@ def test_list_bucket_operations(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2921,13 +2853,12 @@ def test_list_bucket_operations_non_empty_request_with_auto_populated_field(): client.list_bucket_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.ListBucketOperationsRequest( + assert args[0] == storage_batch_operations.ListBucketOperationsRequest( parent='parent_value', filter='filter_value', page_token='page_token_value', order_by='order_by_value', ) - assert args[0] == request_msg def test_list_bucket_operations_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2996,11 +2927,7 @@ async def test_list_bucket_operations_async_use_cached_wrapped_rpc(transport: st assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.ListBucketOperationsRequest({ }), - { }, -]) -async def test_list_bucket_operations_async(request_type, transport: str = 'grpc_asyncio'): +async def test_list_bucket_operations_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.ListBucketOperationsRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3008,7 +2935,7 @@ async def test_list_bucket_operations_async(request_type, transport: str = 'grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3032,6 +2959,11 @@ async def test_list_bucket_operations_async(request_type, transport: str = 'grpc assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] + +@pytest.mark.asyncio +async def test_list_bucket_operations_async_from_dict(): + await test_list_bucket_operations_async(request_type=dict) + def test_list_bucket_operations_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3372,10 +3304,8 @@ async def test_list_bucket_operations_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - storage_batch_operations.GetBucketOperationRequest({ - }), - { - }, + storage_batch_operations.GetBucketOperationRequest, + dict, ]) def test_get_bucket_operation(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -3385,7 +3315,7 @@ def test_get_bucket_operation(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3435,10 +3365,9 @@ def test_get_bucket_operation_non_empty_request_with_auto_populated_field(): client.get_bucket_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.GetBucketOperationRequest( + assert args[0] == storage_batch_operations.GetBucketOperationRequest( name='name_value', ) - assert args[0] == request_msg def test_get_bucket_operation_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3507,11 +3436,7 @@ async def test_get_bucket_operation_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -@pytest.mark.parametrize("request_type", [ - storage_batch_operations.GetBucketOperationRequest({ }), - { }, -]) -async def test_get_bucket_operation_async(request_type, transport: str = 'grpc_asyncio'): +async def test_get_bucket_operation_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.GetBucketOperationRequest): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3519,7 +3444,7 @@ async def test_get_bucket_operation_async(request_type, transport: str = 'grpc_a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3545,6 +3470,11 @@ async def test_get_bucket_operation_async(request_type, transport: str = 'grpc_a assert response.bucket_name == 'bucket_name_value' assert response.state == storage_batch_operations_types.BucketOperation.State.QUEUED + +@pytest.mark.asyncio +async def test_get_bucket_operation_async_from_dict(): + await test_get_bucket_operation_async(request_type=dict) + def test_get_bucket_operation_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4205,7 +4135,7 @@ def test_create_job_rest_required_fields(request_type=storage_batch_operations.C # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert _UUID4_RE.match(value) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) break # Include requestId within expected_params with value mock.ANY @@ -4383,7 +4313,7 @@ def test_delete_job_rest_required_fields(request_type=storage_batch_operations.D # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert _UUID4_RE.match(value) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) break # Include requestId within expected_params with value mock.ANY @@ -4559,7 +4489,7 @@ def test_cancel_job_rest_required_fields(request_type=storage_batch_operations.C # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert _UUID4_RE.match(value) + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) break # Include requestId within expected_params with value mock.ANY @@ -5149,6 +5079,7 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListJobsRequest() + assert args[0] == request_msg @@ -5171,6 +5102,7 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetJobRequest() + assert args[0] == request_msg @@ -5192,10 +5124,12 @@ def test_create_job_empty_call_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CreateJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.CreateJobRequest() + assert args[0] == request_msg @@ -5217,10 +5151,12 @@ def test_delete_job_empty_call_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.DeleteJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.DeleteJobRequest() + assert args[0] == request_msg @@ -5242,10 +5178,12 @@ def test_cancel_job_empty_call_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CancelJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.CancelJobRequest() + assert args[0] == request_msg @@ -5268,6 +5206,7 @@ def test_list_bucket_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListBucketOperationsRequest() + assert args[0] == request_msg @@ -5290,6 +5229,7 @@ def test_get_bucket_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetBucketOperationRequest() + assert args[0] == request_msg @@ -5332,6 +5272,7 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListJobsRequest() + assert args[0] == request_msg @@ -5362,6 +5303,7 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetJobRequest() + assert args[0] == request_msg @@ -5387,10 +5329,12 @@ async def test_create_job_empty_call_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CreateJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.CreateJobRequest() + assert args[0] == request_msg @@ -5414,10 +5358,12 @@ async def test_delete_job_empty_call_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.DeleteJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.DeleteJobRequest() + assert args[0] == request_msg @@ -5442,10 +5388,12 @@ async def test_cancel_job_empty_call_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CancelJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.CancelJobRequest() + assert args[0] == request_msg @@ -5473,6 +5421,7 @@ async def test_list_bucket_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListBucketOperationsRequest() + assert args[0] == request_msg @@ -5501,6 +5450,7 @@ async def test_get_bucket_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetBucketOperationRequest() + assert args[0] == request_msg @@ -6653,6 +6603,7 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListJobsRequest() + assert args[0] == request_msg @@ -6674,6 +6625,7 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetJobRequest() + assert args[0] == request_msg @@ -6694,10 +6646,12 @@ def test_create_job_empty_call_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CreateJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.CreateJobRequest() + assert args[0] == request_msg @@ -6718,10 +6672,12 @@ def test_delete_job_empty_call_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.DeleteJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.DeleteJobRequest() + assert args[0] == request_msg @@ -6742,10 +6698,12 @@ def test_cancel_job_empty_call_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - request_msg = storage_batch_operations.CancelJobRequest() # Ensure that the uuid4 field is set according to AIP 4235 - assert _UUID4_RE.fullmatch(args[0].request_id) - request_msg.request_id = args[0].request_id + assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) + # clear UUID field so that the check below succeeds + args[0].request_id = None + request_msg = storage_batch_operations.CancelJobRequest() + assert args[0] == request_msg @@ -6767,6 +6725,7 @@ def test_list_bucket_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListBucketOperationsRequest() + assert args[0] == request_msg @@ -6788,6 +6747,7 @@ def test_get_bucket_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetBucketOperationRequest() + assert args[0] == request_msg From bc939843fe9f43ed2a7e2c25702a5506f63e09d1 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 11:33:02 -0400 Subject: [PATCH 12/28] test(generator): Bump grpcio to 1.59.0 in showcase test constraints templates and integration goldens --- .../gapic/templates/testing/constraints-3.10.txt.j2 | 2 +- .../integration/goldens/asset/testing/constraints-3.10.txt | 2 +- .../goldens/credentials/testing/constraints-3.10.txt | 2 +- .../integration/goldens/eventarc/testing/constraints-3.10.txt | 2 +- .../integration/goldens/logging/testing/constraints-3.10.txt | 2 +- .../goldens/logging_internal/testing/constraints-3.10.txt | 2 +- .../integration/goldens/redis/testing/constraints-3.10.txt | 2 +- .../goldens/redis_selective/testing/constraints-3.10.txt | 2 +- .../goldens/storagebatchoperations/testing/constraints-3.10.txt | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/gapic-generator/gapic/templates/testing/constraints-3.10.txt.j2 b/packages/gapic-generator/gapic/templates/testing/constraints-3.10.txt.j2 index eb8dc323f481..63ad4c20f28b 100644 --- a/packages/gapic-generator/gapic/templates/testing/constraints-3.10.txt.j2 +++ b/packages/gapic-generator/gapic/templates/testing/constraints-3.10.txt.j2 @@ -7,7 +7,7 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 {% for package_tuple, package_info in pypi_packages.items() %} diff --git a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.10.txt index 88ca48cac49d..554a13c22f32 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.10.txt @@ -6,7 +6,7 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 google-cloud-access-context-manager==0.2.0 diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.10.txt @@ -6,7 +6,7 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 grpc-google-iam-v1==0.14.0 diff --git a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.10.txt b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.10.txt +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 From 5838c99b9d584c2914f5682d25466b5355bfd624 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 12:53:04 -0400 Subject: [PATCH 13/28] chore(gapic-generator): natively regenerate all 8 integration test goldens with grpcio 1.59.0 --- .../integration/goldens/asset/noxfile.py | 7 ++- .../tests/integration/goldens/asset/setup.py | 2 +- .../goldens/credentials/noxfile.py | 7 ++- .../integration/goldens/credentials/setup.py | 2 +- .../integration/goldens/eventarc/noxfile.py | 7 ++- .../integration/goldens/eventarc/setup.py | 2 +- .../integration/goldens/logging/noxfile.py | 7 ++- .../integration/goldens/logging/setup.py | 2 +- .../goldens/logging_internal/noxfile.py | 7 ++- ...onfig_service_v2_copy_log_entries_async.py | 57 +++++++++++++++++++ ...config_service_v2_copy_log_entries_sync.py | 57 +++++++++++++++++++ ...onfig_service_v2_create_exclusion_async.py | 57 +++++++++++++++++++ ...config_service_v2_create_exclusion_sync.py | 57 +++++++++++++++++++ ...ted_config_service_v2_create_link_async.py | 57 +++++++++++++++++++ ...ated_config_service_v2_create_link_sync.py | 57 +++++++++++++++++++ ...ted_config_service_v2_create_sink_async.py | 57 +++++++++++++++++++ ...ated_config_service_v2_create_sink_sync.py | 57 +++++++++++++++++++ ...ted_config_service_v2_create_view_async.py | 53 +++++++++++++++++ ...ated_config_service_v2_create_view_sync.py | 53 +++++++++++++++++ ...onfig_service_v2_delete_exclusion_async.py | 50 ++++++++++++++++ ...config_service_v2_delete_exclusion_sync.py | 50 ++++++++++++++++ ...ted_config_service_v2_delete_link_async.py | 56 ++++++++++++++++++ ...ated_config_service_v2_delete_link_sync.py | 56 ++++++++++++++++++ ...ted_config_service_v2_delete_sink_async.py | 50 ++++++++++++++++ ...ated_config_service_v2_delete_sink_sync.py | 50 ++++++++++++++++ ...ted_config_service_v2_delete_view_async.py | 50 ++++++++++++++++ ...ated_config_service_v2_delete_view_sync.py | 50 ++++++++++++++++ ...nfig_service_v2_get_cmek_settings_async.py | 52 +++++++++++++++++ ...onfig_service_v2_get_cmek_settings_sync.py | 52 +++++++++++++++++ ...d_config_service_v2_get_exclusion_async.py | 52 +++++++++++++++++ ...ed_config_service_v2_get_exclusion_sync.py | 52 +++++++++++++++++ ...erated_config_service_v2_get_link_async.py | 52 +++++++++++++++++ ...nerated_config_service_v2_get_link_sync.py | 52 +++++++++++++++++ ...ed_config_service_v2_get_settings_async.py | 52 +++++++++++++++++ ...ted_config_service_v2_get_settings_sync.py | 52 +++++++++++++++++ ...erated_config_service_v2_get_sink_async.py | 52 +++++++++++++++++ ...nerated_config_service_v2_get_sink_sync.py | 52 +++++++++++++++++ ...erated_config_service_v2_get_view_async.py | 52 +++++++++++++++++ ...nerated_config_service_v2_get_view_sync.py | 52 +++++++++++++++++ ...config_service_v2_list_exclusions_async.py | 53 +++++++++++++++++ ..._config_service_v2_list_exclusions_sync.py | 53 +++++++++++++++++ ...ated_config_service_v2_list_links_async.py | 53 +++++++++++++++++ ...rated_config_service_v2_list_links_sync.py | 53 +++++++++++++++++ ...ated_config_service_v2_list_sinks_async.py | 53 +++++++++++++++++ ...rated_config_service_v2_list_sinks_sync.py | 53 +++++++++++++++++ ...ated_config_service_v2_list_views_async.py | 53 +++++++++++++++++ ...rated_config_service_v2_list_views_sync.py | 53 +++++++++++++++++ ...g_service_v2_update_cmek_settings_async.py | 52 +++++++++++++++++ ...ig_service_v2_update_cmek_settings_sync.py | 52 +++++++++++++++++ ...onfig_service_v2_update_exclusion_async.py | 57 +++++++++++++++++++ ...config_service_v2_update_exclusion_sync.py | 57 +++++++++++++++++++ ...config_service_v2_update_settings_async.py | 52 +++++++++++++++++ ..._config_service_v2_update_settings_sync.py | 52 +++++++++++++++++ ...ted_config_service_v2_update_sink_async.py | 57 +++++++++++++++++++ ...ated_config_service_v2_update_sink_sync.py | 57 +++++++++++++++++++ ...ted_config_service_v2_update_view_async.py | 52 +++++++++++++++++ ...ated_config_service_v2_update_view_sync.py | 52 +++++++++++++++++ ...rics_service_v2_create_log_metric_async.py | 57 +++++++++++++++++++ ...trics_service_v2_create_log_metric_sync.py | 57 +++++++++++++++++++ ...rics_service_v2_delete_log_metric_async.py | 50 ++++++++++++++++ ...trics_service_v2_delete_log_metric_sync.py | 50 ++++++++++++++++ ...metrics_service_v2_get_log_metric_async.py | 52 +++++++++++++++++ ..._metrics_service_v2_get_log_metric_sync.py | 52 +++++++++++++++++ ...trics_service_v2_list_log_metrics_async.py | 53 +++++++++++++++++ ...etrics_service_v2_list_log_metrics_sync.py | 53 +++++++++++++++++ ...rics_service_v2_update_log_metric_async.py | 57 +++++++++++++++++++ ...trics_service_v2_update_log_metric_sync.py | 57 +++++++++++++++++++ .../goldens/logging_internal/setup.py | 2 +- .../integration/goldens/redis/noxfile.py | 7 ++- .../tests/integration/goldens/redis/setup.py | 2 +- .../goldens/redis_selective/noxfile.py | 7 ++- .../goldens/redis_selective/setup.py | 2 +- .../goldens/storagebatchoperations/noxfile.py | 7 ++- .../goldens/storagebatchoperations/setup.py | 2 +- 74 files changed, 3156 insertions(+), 16 deletions(-) create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py create mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py diff --git a/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py b/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py index 9abef9c30d27..c1165ab621e1 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-asset" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/asset/setup.py b/packages/gapic-generator/tests/integration/goldens/asset/setup.py index b3edba3fb4b8..2a8d122f099c 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py b/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py index bfa0326f3845..9a9064f2db91 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-iam-credentials" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/setup.py b/packages/gapic-generator/tests/integration/goldens/credentials/setup.py index 981dd77901cc..cb2edb25790b 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py b/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py index 18dbb71ca4ee..a2ac36b7783a 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-eventarc" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/setup.py b/packages/gapic-generator/tests/integration/goldens/eventarc/setup.py index ab7e57a4de6a..58e6940bcf39 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py b/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py index f7e6f9091aaf..6711f0bb5fdd 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/logging/setup.py b/packages/gapic-generator/tests/integration/goldens/logging/setup.py index 3129ae9c7ce5..0b9176488ae6 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py index f7e6f9091aaf..6711f0bb5fdd 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py new file mode 100755 index 000000000000..90e20d86d139 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CopyLogEntries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_copy_log_entries(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CopyLogEntriesRequest( + name="name_value", + destination="destination_value", + ) + + # Make the request + operation = await client.copy_log_entries(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py new file mode 100755 index 000000000000..22f4a89100e6 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CopyLogEntries +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_copy_log_entries(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.CopyLogEntriesRequest( + name="name_value", + destination="destination_value", + ) + + # Make the request + operation = client.copy_log_entries(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py new file mode 100755 index 000000000000..55b54ba80988 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_create_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.CreateExclusionRequest( + parent="parent_value", + exclusion=exclusion, + ) + + # Make the request + response = await client.create_exclusion(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py new file mode 100755 index 000000000000..20f0c58bbe1e --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateExclusion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_create_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.CreateExclusionRequest( + parent="parent_value", + exclusion=exclusion, + ) + + # Make the request + response = client.create_exclusion(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py new file mode 100755 index 000000000000..5abb38d26543 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateLink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_create_link(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateLinkRequest( + parent="parent_value", + link_id="link_id_value", + ) + + # Make the request + operation = await client.create_link(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateLink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py new file mode 100755 index 000000000000..53e3ef498d42 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateLink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_create_link(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.CreateLinkRequest( + parent="parent_value", + link_id="link_id_value", + ) + + # Make the request + operation = client.create_link(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateLink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py new file mode 100755 index 000000000000..347613351c89 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateSink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_create_sink(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.CreateSinkRequest( + parent="parent_value", + sink=sink, + ) + + # Make the request + response = await client.create_sink(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py new file mode 100755 index 000000000000..a8a0c50eaa67 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateSink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_create_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.CreateSinkRequest( + parent="parent_value", + sink=sink, + ) + + # Make the request + response = client.create_sink(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py new file mode 100755 index 000000000000..d1fcc672437b --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateView_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_create_view(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.CreateViewRequest( + parent="parent_value", + view_id="view_id_value", + ) + + # Make the request + response = await client.create_view(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py new file mode 100755 index 000000000000..7044f07a6148 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_CreateView_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_create_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.CreateViewRequest( + parent="parent_value", + view_id="view_id_value", + ) + + # Make the request + response = client.create_view(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_CreateView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py new file mode 100755 index 000000000000..53cc11b50d3d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_delete_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteExclusionRequest( + name="name_value", + ) + + # Make the request + await client.delete_exclusion(request=request) + + +# [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py new file mode 100755 index 000000000000..9e1c040d7a0a --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_delete_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.DeleteExclusionRequest( + name="name_value", + ) + + # Make the request + client.delete_exclusion(request=request) + + +# [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py new file mode 100755 index 000000000000..aea2a439f7d1 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteLink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_delete_link(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteLinkRequest( + name="name_value", + ) + + # Make the request + operation = await client.delete_link(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_DeleteLink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py new file mode 100755 index 000000000000..d53d63512e21 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteLink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_delete_link(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.DeleteLinkRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_link(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_DeleteLink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py new file mode 100755 index 000000000000..efaea776bcca --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_delete_sink(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteSinkRequest( + sink_name="sink_name_value", + ) + + # Make the request + await client.delete_sink(request=request) + + +# [END logging_v2_generated_ConfigServiceV2_DeleteSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py new file mode 100755 index 000000000000..72d3453274e3 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteSink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_delete_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.DeleteSinkRequest( + sink_name="sink_name_value", + ) + + # Make the request + client.delete_sink(request=request) + + +# [END logging_v2_generated_ConfigServiceV2_DeleteSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py new file mode 100755 index 000000000000..0cdc9fd2e451 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteView_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_delete_view(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteViewRequest( + name="name_value", + ) + + # Make the request + await client.delete_view(request=request) + + +# [END logging_v2_generated_ConfigServiceV2_DeleteView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py new file mode 100755 index 000000000000..af7e91ed6aec --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_DeleteView_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_delete_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.DeleteViewRequest( + name="name_value", + ) + + # Make the request + client.delete_view(request=request) + + +# [END logging_v2_generated_ConfigServiceV2_DeleteView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py new file mode 100755 index 000000000000..49a21345a274 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCmekSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetCmekSettingsRequest( + name="name_value", + ) + + # Make the request + response = await client.get_cmek_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py new file mode 100755 index 000000000000..1f4985826991 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCmekSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetCmekSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.get_cmek_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py new file mode 100755 index 000000000000..83835787611f --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetExclusionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_exclusion(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py new file mode 100755 index 000000000000..d50baed9dd90 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetExclusion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetExclusionRequest( + name="name_value", + ) + + # Make the request + response = client.get_exclusion(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py new file mode 100755 index 000000000000..c872e56d2523 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetLink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_link(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetLinkRequest( + name="name_value", + ) + + # Make the request + response = await client.get_link(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetLink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py new file mode 100755 index 000000000000..c601d4f67ab4 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetLink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_link(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetLinkRequest( + name="name_value", + ) + + # Make the request + response = client.get_link(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetLink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py new file mode 100755 index 000000000000..22673d5093de --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetSettings_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_settings(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetSettingsRequest( + name="name_value", + ) + + # Make the request + response = await client.get_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py new file mode 100755 index 000000000000..577f1624647f --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetSettings_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.get_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py new file mode 100755 index 000000000000..c90fc064cc6e --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetSink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_sink(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetSinkRequest( + sink_name="sink_name_value", + ) + + # Make the request + response = await client.get_sink(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py new file mode 100755 index 000000000000..3f0eff039087 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetSink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetSinkRequest( + sink_name="sink_name_value", + ) + + # Make the request + response = client.get_sink(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py new file mode 100755 index 000000000000..40d5f951abda --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetView_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_view(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetViewRequest( + name="name_value", + ) + + # Make the request + response = await client.get_view(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py new file mode 100755 index 000000000000..d41b2b95c53d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_GetView_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetViewRequest( + name="name_value", + ) + + # Make the request + response = client.get_view(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_GetView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py new file mode 100755 index 000000000000..0fe921da96be --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListExclusions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_list_exclusions(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListExclusionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_exclusions(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListExclusions_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py new file mode 100755 index 000000000000..ef51d0d57132 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListExclusions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListExclusions_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_list_exclusions(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListExclusionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_exclusions(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListExclusions_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py new file mode 100755 index 000000000000..a73457c02e4a --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListLinks_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_list_links(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListLinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_links(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListLinks_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py new file mode 100755 index 000000000000..b349cd2b837f --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListLinks_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_list_links(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListLinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_links(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListLinks_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py new file mode 100755 index 000000000000..c10f027ed91a --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListSinks_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_list_sinks(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListSinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_sinks(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListSinks_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py new file mode 100755 index 000000000000..d3f694adc029 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListSinks_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_list_sinks(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListSinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_sinks(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListSinks_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py new file mode 100755 index 000000000000..bec578a8c629 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListViews +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListViews_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_list_views(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListViewsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_views(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListViews_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py new file mode 100755 index 000000000000..726d8e17aa01 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListViews +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_ListViews_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_list_views(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListViewsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_views(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END logging_v2_generated_ConfigServiceV2_ListViews_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py new file mode 100755 index 000000000000..80d4eec6bd06 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCmekSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_update_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateCmekSettingsRequest( + name="name_value", + ) + + # Make the request + response = await client.update_cmek_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py new file mode 100755 index 000000000000..f0d2fec56eb0 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCmekSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_update_cmek_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateCmekSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.update_cmek_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py new file mode 100755 index 000000000000..862c4f56240a --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_update_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.UpdateExclusionRequest( + name="name_value", + exclusion=exclusion, + ) + + # Make the request + response = await client.update_exclusion(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py new file mode 100755 index 000000000000..c9d932be084e --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateExclusion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_update_exclusion(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + exclusion = logging_v2.LogExclusion() + exclusion.name = "name_value" + exclusion.filter = "filter_value" + + request = logging_v2.UpdateExclusionRequest( + name="name_value", + exclusion=exclusion, + ) + + # Make the request + response = client.update_exclusion(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py new file mode 100755 index 000000000000..add426ab48d7 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_update_settings(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateSettingsRequest( + name="name_value", + ) + + # Make the request + response = await client.update_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py new file mode 100755 index 000000000000..3c6ae06710ce --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateSettings_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_update_settings(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.update_settings(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py new file mode 100755 index 000000000000..029bc692a146 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_update_sink(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.UpdateSinkRequest( + sink_name="sink_name_value", + sink=sink, + ) + + # Make the request + response = await client.update_sink(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py new file mode 100755 index 000000000000..1cd230a4d4f9 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateSink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateSink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_update_sink(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + sink = logging_v2.LogSink() + sink.name = "name_value" + sink.destination = "destination_value" + + request = logging_v2.UpdateSinkRequest( + sink_name="sink_name_value", + sink=sink, + ) + + # Make the request + response = client.update_sink(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py new file mode 100755 index 000000000000..bc475e8f1a36 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateView_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_update_view(): + # Create a client + client = logging_v2.ConfigServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.UpdateViewRequest( + name="name_value", + ) + + # Make the request + response = await client.update_view(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py new file mode 100755 index 000000000000..618f1739cc93 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateView +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_ConfigServiceV2_UpdateView_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_update_view(): + # Create a client + client = logging_v2.ConfigServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.UpdateViewRequest( + name="name_value", + ) + + # Make the request + response = client.update_view(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_ConfigServiceV2_UpdateView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py new file mode 100755 index 000000000000..27937e73f86d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_create_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.CreateLogMetricRequest( + parent="parent_value", + metric=metric, + ) + + # Make the request + response = await client.create_log_metric(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py new file mode 100755 index 000000000000..bac12f350ec4 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_create_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.CreateLogMetricRequest( + parent="parent_value", + metric=metric, + ) + + # Make the request + response = client.create_log_metric(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py new file mode 100755 index 000000000000..f5a7e482a45a --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_delete_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.DeleteLogMetricRequest( + metric_name="metric_name_value", + ) + + # Make the request + await client.delete_log_metric(request=request) + + +# [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py new file mode 100755 index 000000000000..7c07c79f6a1c --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_delete_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.DeleteLogMetricRequest( + metric_name="metric_name_value", + ) + + # Make the request + client.delete_log_metric(request=request) + + +# [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py new file mode 100755 index 000000000000..a58c0902d6a6 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_get_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.GetLogMetricRequest( + metric_name="metric_name_value", + ) + + # Make the request + response = await client.get_log_metric(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_MetricsServiceV2_GetLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py new file mode 100755 index 000000000000..566b5ddbabd1 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_GetLogMetric_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_get_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.GetLogMetricRequest( + metric_name="metric_name_value", + ) + + # Make the request + response = client.get_log_metric(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_MetricsServiceV2_GetLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py new file mode 100755 index 000000000000..332fa974fe90 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLogMetrics +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_list_log_metrics(): + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + request = logging_v2.ListLogMetricsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_log_metrics(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py new file mode 100755 index 000000000000..2206611ef882 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListLogMetrics +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_list_log_metrics(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + request = logging_v2.ListLogMetricsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_log_metrics(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py new file mode 100755 index 000000000000..7ac109f2a37f --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +async def sample_update_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2AsyncClient() + + # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.UpdateLogMetricRequest( + metric_name="metric_name_value", + metric=metric, + ) + + # Make the request + response = await client.update_log_metric(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py new file mode 100755 index 000000000000..666714c20bd1 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateLogMetric +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-logging + + +# [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import logging_v2 + + +def sample_update_log_metric(): + # Create a client + client = logging_v2.MetricsServiceV2Client() + + # Initialize request argument(s) + metric = logging_v2.LogMetric() + metric.name = "name_value" + metric.filter = "filter_value" + + request = logging_v2.UpdateLogMetricRequest( + metric_name="metric_name_value", + metric=metric, + ) + + # Make the request + response = client.update_log_metric(request=request) + + # Handle the response + print(response) + +# [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/setup.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/setup.py index 3129ae9c7ce5..0b9176488ae6 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py b/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py index 05e6e98292a4..84b5d3547097 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-redis" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/redis/setup.py b/packages/gapic-generator/tests/integration/goldens/redis/setup.py index c79f6b3a2875..358f0f73ee87 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py index 05e6e98292a4..84b5d3547097 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-redis" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/setup.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/setup.py index c79f6b3a2875..358f0f73ee87 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py index 9dbe1aa24718..fb5c85be9473 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py @@ -48,7 +48,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-storagebatchoperations" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/setup.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/setup.py index 2af3073000f0..34dbb3ed7860 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/setup.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/setup.py @@ -43,7 +43,7 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", From 5010609b6cdc39e98aad74d93375744b6be3c295 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 13:07:40 -0400 Subject: [PATCH 14/28] fix(gapic-generator): inject autouse event loop fixture to prevent asyncio loop RuntimeError in unit tests --- .../unit/gapic/%name_%version/%sub/test_%service.py.j2 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index bd5d5a42ff7f..ef6def89d8c3 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -7,6 +7,7 @@ {% import "%namespace/%name_%version/%sub/services/%service/_shared_macros.j2" as shared_macros %} import os +import asyncio {% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} import re {% endif %} @@ -140,6 +141,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" From 810174e878354cd4f7b8f74e21f343450c941796 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 13:30:51 -0400 Subject: [PATCH 15/28] fix(gapic-generator): align grpcio lower-bound pin to 1.59.0 in async-rest constraints template --- .../gapic/templates/testing/constraints-3.10-async-rest.txt.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gapic-generator/gapic/templates/testing/constraints-3.10-async-rest.txt.j2 b/packages/gapic-generator/gapic/templates/testing/constraints-3.10-async-rest.txt.j2 index 3a1222949a04..9f0051916ec0 100644 --- a/packages/gapic-generator/gapic/templates/testing/constraints-3.10-async-rest.txt.j2 +++ b/packages/gapic-generator/gapic/templates/testing/constraints-3.10-async-rest.txt.j2 @@ -10,7 +10,7 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.21.0 google-auth==2.35.0 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 {% for package_tuple, package_info in pypi_packages.items() %} From 090daba973642c5e1f8cff5d4a60f34e323835b0 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 13:36:46 -0400 Subject: [PATCH 16/28] chore(gapic-generator): regenerate all 8 goldens to include autouse event loop fixture and async-rest constraints updates --- .../tests/unit/gapic/asset_v1/test_asset_service.py | 10 ++++++++++ .../unit/gapic/credentials_v1/test_iam_credentials.py | 10 ++++++++++ .../tests/unit/gapic/eventarc_v1/test_eventarc.py | 10 ++++++++++ .../unit/gapic/logging_v2/test_config_service_v2.py | 10 ++++++++++ .../unit/gapic/logging_v2/test_logging_service_v2.py | 10 ++++++++++ .../unit/gapic/logging_v2/test_metrics_service_v2.py | 10 ++++++++++ .../unit/gapic/logging_v2/test_config_service_v2.py | 10 ++++++++++ .../unit/gapic/logging_v2/test_logging_service_v2.py | 10 ++++++++++ .../unit/gapic/logging_v2/test_metrics_service_v2.py | 10 ++++++++++ .../redis/testing/constraints-3.10-async-rest.txt | 2 +- .../tests/unit/gapic/redis_v1/test_cloud_redis.py | 10 ++++++++++ .../testing/constraints-3.10-async-rest.txt | 2 +- .../tests/unit/gapic/redis_v1/test_cloud_redis.py | 10 ++++++++++ .../test_storage_batch_operations.py | 10 ++++++++++ 14 files changed, 122 insertions(+), 2 deletions(-) diff --git a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py index 83641272747f..520a7743d90d 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -105,6 +106,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py index 6c0f3aea78a5..20e9b27ad075 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -95,6 +96,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index 8e7e63348ec5..e06e9f277fa1 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -126,6 +127,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index d5d1ea7d6c24..bd1f6774c8fb 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -96,6 +97,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 380fafa006a1..392b1a3e2703 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -97,6 +98,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index d9cd47627b2b..ac94c1a8577e 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -95,6 +96,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py index 116ef7e2a7c0..159ce28b2069 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -96,6 +97,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 380fafa006a1..392b1a3e2703 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -97,6 +98,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 987ff7bf337b..4d72e7245166 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -95,6 +96,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10-async-rest.txt b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10-async-rest.txt index 6b058713e3d3..4148e63e7dd1 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10-async-rest.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.10-async-rest.txt @@ -7,6 +7,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.21.0 google-auth==2.35.0 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 9ad9492c3db4..c70a998f17da 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -113,6 +114,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10-async-rest.txt b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10-async-rest.txt index 6b058713e3d3..4148e63e7dd1 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10-async-rest.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.10-async-rest.txt @@ -7,6 +7,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.21.0 google-auth==2.35.0 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py index a505c3a8ca69..08cc96474eab 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio from unittest import mock from unittest.mock import AsyncMock @@ -113,6 +114,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index f25a28395082..dac7e5280939 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py @@ -14,6 +14,7 @@ # limitations under the License. # import os +import asyncio import re from unittest import mock from unittest.mock import AsyncMock @@ -105,6 +106,15 @@ def modify_default_endpoint_template(client): return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" From 5d57685e3db3b26438a66ff3eed94e90840c34a5 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 15:15:44 -0400 Subject: [PATCH 17/28] test(gapic-generator): experimental pin pytest-asyncio in constraints-3.14.txt and add pip freeze logger --- .../gapic/templates/testing/constraints-3.14.txt.j2 | 1 + packages/gapic-generator/noxfile.py | 3 +++ .../integration/goldens/asset/testing/constraints-3.14.txt | 1 + .../goldens/credentials/testing/constraints-3.14.txt | 1 + .../integration/goldens/eventarc/testing/constraints-3.14.txt | 1 + .../integration/goldens/logging/testing/constraints-3.14.txt | 1 + .../goldens/logging_internal/testing/constraints-3.14.txt | 1 + .../integration/goldens/redis/testing/constraints-3.14.txt | 1 + .../goldens/redis_selective/testing/constraints-3.14.txt | 1 + .../storagebatchoperations/testing/constraints-3.14.txt | 1 + 10 files changed, 12 insertions(+) diff --git a/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 b/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 index c2e7b8a9934c..62d737cc72e1 100644 --- a/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 +++ b/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 @@ -11,6 +11,7 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 {% for package_tuple, package_info in pypi_packages.items() %} {# Quick check to make sure `package_info.package_name` is not the package being generated so we don't circularly include this package in its own constraints file. #} {% if api.naming.warehouse_package_name != package_info.package_name %} diff --git a/packages/gapic-generator/noxfile.py b/packages/gapic-generator/noxfile.py index 24bd8bd4c8d3..8ef965740c2b 100644 --- a/packages/gapic-generator/noxfile.py +++ b/packages/gapic-generator/noxfile.py @@ -482,6 +482,9 @@ def run_showcase_unit_tests(session, fail_under=100, rest_async_io_enabled=False "pytest-xdist", "pytest-asyncio", ) + # Freeze and print python environment package versions + session.run("python", "-m", "pip", "freeze") + # Run the tests. session.run( "py.test", diff --git a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt index c3db09a0c746..8490ada86745 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt @@ -10,6 +10,7 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 google-cloud-access-context-manager>=0 google-cloud-os-config>=1 grpc-google-iam-v1>=0 diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt index 1e93c60e50aa..e483793733f2 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt @@ -10,3 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt index 2ae5a677e852..db44cc0adec9 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt @@ -10,4 +10,5 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 grpc-google-iam-v1>=0 diff --git a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt index 1e93c60e50aa..e483793733f2 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt @@ -10,3 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt index 1e93c60e50aa..e483793733f2 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt @@ -10,3 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt index 1e93c60e50aa..e483793733f2 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt @@ -10,3 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt index 1e93c60e50aa..e483793733f2 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt @@ -10,3 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt index 1e93c60e50aa..e483793733f2 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt @@ -10,3 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 +pytest-asyncio>=1.3.0 From 6741139edc4acd84d95080daff80f7256ae2be53 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 20:14:40 -0400 Subject: [PATCH 18/28] fix(gapic-generator): resolve macro typo and recursively prune 145 stale selective logging_internal golden snippets --- .../test/integration_test.bzl | 2 +- ...onfig_service_v2_copy_log_entries_async.py | 57 ------------------- ...config_service_v2_copy_log_entries_sync.py | 57 ------------------- ...onfig_service_v2_create_exclusion_async.py | 57 ------------------- ...config_service_v2_create_exclusion_sync.py | 57 ------------------- ...ted_config_service_v2_create_link_async.py | 57 ------------------- ...ated_config_service_v2_create_link_sync.py | 57 ------------------- ...ted_config_service_v2_create_sink_async.py | 57 ------------------- ...ated_config_service_v2_create_sink_sync.py | 57 ------------------- ...ted_config_service_v2_create_view_async.py | 53 ----------------- ...ated_config_service_v2_create_view_sync.py | 53 ----------------- ...onfig_service_v2_delete_exclusion_async.py | 50 ---------------- ...config_service_v2_delete_exclusion_sync.py | 50 ---------------- ...ted_config_service_v2_delete_link_async.py | 56 ------------------ ...ated_config_service_v2_delete_link_sync.py | 56 ------------------ ...ted_config_service_v2_delete_sink_async.py | 50 ---------------- ...ated_config_service_v2_delete_sink_sync.py | 50 ---------------- ...ted_config_service_v2_delete_view_async.py | 50 ---------------- ...ated_config_service_v2_delete_view_sync.py | 50 ---------------- ...nfig_service_v2_get_cmek_settings_async.py | 52 ----------------- ...onfig_service_v2_get_cmek_settings_sync.py | 52 ----------------- ...d_config_service_v2_get_exclusion_async.py | 52 ----------------- ...ed_config_service_v2_get_exclusion_sync.py | 52 ----------------- ...erated_config_service_v2_get_link_async.py | 52 ----------------- ...nerated_config_service_v2_get_link_sync.py | 52 ----------------- ...ed_config_service_v2_get_settings_async.py | 52 ----------------- ...ted_config_service_v2_get_settings_sync.py | 52 ----------------- ...erated_config_service_v2_get_sink_async.py | 52 ----------------- ...nerated_config_service_v2_get_sink_sync.py | 52 ----------------- ...erated_config_service_v2_get_view_async.py | 52 ----------------- ...nerated_config_service_v2_get_view_sync.py | 52 ----------------- ...config_service_v2_list_exclusions_async.py | 53 ----------------- ..._config_service_v2_list_exclusions_sync.py | 53 ----------------- ...ated_config_service_v2_list_links_async.py | 53 ----------------- ...rated_config_service_v2_list_links_sync.py | 53 ----------------- ...ated_config_service_v2_list_sinks_async.py | 53 ----------------- ...rated_config_service_v2_list_sinks_sync.py | 53 ----------------- ...ated_config_service_v2_list_views_async.py | 53 ----------------- ...rated_config_service_v2_list_views_sync.py | 53 ----------------- ...g_service_v2_update_cmek_settings_async.py | 52 ----------------- ...ig_service_v2_update_cmek_settings_sync.py | 52 ----------------- ...onfig_service_v2_update_exclusion_async.py | 57 ------------------- ...config_service_v2_update_exclusion_sync.py | 57 ------------------- ...config_service_v2_update_settings_async.py | 52 ----------------- ..._config_service_v2_update_settings_sync.py | 52 ----------------- ...ted_config_service_v2_update_sink_async.py | 57 ------------------- ...ated_config_service_v2_update_sink_sync.py | 57 ------------------- ...ted_config_service_v2_update_view_async.py | 52 ----------------- ...ated_config_service_v2_update_view_sync.py | 52 ----------------- ...rics_service_v2_create_log_metric_async.py | 57 ------------------- ...trics_service_v2_create_log_metric_sync.py | 57 ------------------- ...rics_service_v2_delete_log_metric_async.py | 50 ---------------- ...trics_service_v2_delete_log_metric_sync.py | 50 ---------------- ...metrics_service_v2_get_log_metric_async.py | 52 ----------------- ..._metrics_service_v2_get_log_metric_sync.py | 52 ----------------- ...trics_service_v2_list_log_metrics_async.py | 53 ----------------- ...etrics_service_v2_list_log_metrics_sync.py | 53 ----------------- ...rics_service_v2_update_log_metric_async.py | 57 ------------------- ...trics_service_v2_update_log_metric_sync.py | 57 ------------------- 59 files changed, 1 insertion(+), 3101 deletions(-) delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py delete mode 100755 packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py diff --git a/packages/gapic-generator/rules_python_gapic/test/integration_test.bzl b/packages/gapic-generator/rules_python_gapic/test/integration_test.bzl index 82e27a7ad5ce..7aaea5ab267c 100644 --- a/packages/gapic-generator/rules_python_gapic/test/integration_test.bzl +++ b/packages/gapic-generator/rules_python_gapic/test/integration_test.bzl @@ -114,7 +114,7 @@ def _overwrite_golden_impl(ctx): golden_update_script_content = """ cd ${{BUILD_WORKSPACE_DIRECTORY}} # Filename pattern-based removal is needed to preserve the BUILD.bazel file. - find tests/integration/goldens/{api_name}/ -name \\*.py-type f -delete + find tests/integration/goldens/{api_name}/ -name \\*.py -type f -delete find tests/integration/goldens/{api_name}/ -name \\*.json -type f -delete unzip -ao {goldens_output_zip} -d tests/integration/goldens/{api_name} """.format( diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py deleted file mode 100755 index 90e20d86d139..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CopyLogEntries -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_copy_log_entries(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.CopyLogEntriesRequest( - name="name_value", - destination="destination_value", - ) - - # Make the request - operation = await client.copy_log_entries(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py deleted file mode 100755 index 22f4a89100e6..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CopyLogEntries -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_copy_log_entries(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.CopyLogEntriesRequest( - name="name_value", - destination="destination_value", - ) - - # Make the request - operation = client.copy_log_entries(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py deleted file mode 100755 index 55b54ba80988..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_create_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - exclusion = logging_v2.LogExclusion() - exclusion.name = "name_value" - exclusion.filter = "filter_value" - - request = logging_v2.CreateExclusionRequest( - parent="parent_value", - exclusion=exclusion, - ) - - # Make the request - response = await client.create_exclusion(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py deleted file mode 100755 index 20f0c58bbe1e..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateExclusion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_create_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - exclusion = logging_v2.LogExclusion() - exclusion.name = "name_value" - exclusion.filter = "filter_value" - - request = logging_v2.CreateExclusionRequest( - parent="parent_value", - exclusion=exclusion, - ) - - # Make the request - response = client.create_exclusion(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py deleted file mode 100755 index 5abb38d26543..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_create_link(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.CreateLinkRequest( - parent="parent_value", - link_id="link_id_value", - ) - - # Make the request - operation = await client.create_link(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateLink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py deleted file mode 100755 index 53e3ef498d42..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_link_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_create_link(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.CreateLinkRequest( - parent="parent_value", - link_id="link_id_value", - ) - - # Make the request - operation = client.create_link(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateLink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py deleted file mode 100755 index 347613351c89..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateSink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_create_sink(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - sink = logging_v2.LogSink() - sink.name = "name_value" - sink.destination = "destination_value" - - request = logging_v2.CreateSinkRequest( - parent="parent_value", - sink=sink, - ) - - # Make the request - response = await client.create_sink(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py deleted file mode 100755 index a8a0c50eaa67..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateSink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_create_sink(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - sink = logging_v2.LogSink() - sink.name = "name_value" - sink.destination = "destination_value" - - request = logging_v2.CreateSinkRequest( - parent="parent_value", - sink=sink, - ) - - # Make the request - response = client.create_sink(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py deleted file mode 100755 index d1fcc672437b..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateView_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_create_view(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.CreateViewRequest( - parent="parent_value", - view_id="view_id_value", - ) - - # Make the request - response = await client.create_view(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py deleted file mode 100755 index 7044f07a6148..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_CreateView_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_create_view(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.CreateViewRequest( - parent="parent_value", - view_id="view_id_value", - ) - - # Make the request - response = client.create_view(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_CreateView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py deleted file mode 100755 index 53cc11b50d3d..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_delete_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.DeleteExclusionRequest( - name="name_value", - ) - - # Make the request - await client.delete_exclusion(request=request) - - -# [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py deleted file mode 100755 index 9e1c040d7a0a..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_delete_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.DeleteExclusionRequest( - name="name_value", - ) - - # Make the request - client.delete_exclusion(request=request) - - -# [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py deleted file mode 100755 index aea2a439f7d1..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_delete_link(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.DeleteLinkRequest( - name="name_value", - ) - - # Make the request - operation = await client.delete_link(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_DeleteLink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py deleted file mode 100755 index d53d63512e21..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_link_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_delete_link(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.DeleteLinkRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_link(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_DeleteLink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py deleted file mode 100755 index efaea776bcca..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_delete_sink(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.DeleteSinkRequest( - sink_name="sink_name_value", - ) - - # Make the request - await client.delete_sink(request=request) - - -# [END logging_v2_generated_ConfigServiceV2_DeleteSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py deleted file mode 100755 index 72d3453274e3..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteSink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_delete_sink(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.DeleteSinkRequest( - sink_name="sink_name_value", - ) - - # Make the request - client.delete_sink(request=request) - - -# [END logging_v2_generated_ConfigServiceV2_DeleteSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py deleted file mode 100755 index 0cdc9fd2e451..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteView_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_delete_view(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.DeleteViewRequest( - name="name_value", - ) - - # Make the request - await client.delete_view(request=request) - - -# [END logging_v2_generated_ConfigServiceV2_DeleteView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py deleted file mode 100755 index af7e91ed6aec..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_DeleteView_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_delete_view(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.DeleteViewRequest( - name="name_value", - ) - - # Make the request - client.delete_view(request=request) - - -# [END logging_v2_generated_ConfigServiceV2_DeleteView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py deleted file mode 100755 index 49a21345a274..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCmekSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_cmek_settings(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetCmekSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_cmek_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py deleted file mode 100755 index 1f4985826991..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCmekSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_cmek_settings(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetCmekSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_cmek_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py deleted file mode 100755 index 83835787611f..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetExclusionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_exclusion(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py deleted file mode 100755 index d50baed9dd90..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetExclusion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetExclusionRequest( - name="name_value", - ) - - # Make the request - response = client.get_exclusion(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py deleted file mode 100755 index c872e56d2523..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_link(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_link(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetLink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py deleted file mode 100755 index c601d4f67ab4..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_link(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_link(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetLink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py deleted file mode 100755 index 22673d5093de..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_settings(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py deleted file mode 100755 index 577f1624647f..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_settings(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py deleted file mode 100755 index c90fc064cc6e..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetSink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_sink(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetSinkRequest( - sink_name="sink_name_value", - ) - - # Make the request - response = await client.get_sink(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py deleted file mode 100755 index 3f0eff039087..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetSink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_sink(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetSinkRequest( - sink_name="sink_name_value", - ) - - # Make the request - response = client.get_sink(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py deleted file mode 100755 index 40d5f951abda..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetView_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_view(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetViewRequest( - name="name_value", - ) - - # Make the request - response = await client.get_view(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py deleted file mode 100755 index d41b2b95c53d..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_GetView_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_view(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetViewRequest( - name="name_value", - ) - - # Make the request - response = client.get_view(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_GetView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py deleted file mode 100755 index 0fe921da96be..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExclusions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_list_exclusions(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.ListExclusionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_exclusions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListExclusions_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py deleted file mode 100755 index ef51d0d57132..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExclusions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListExclusions_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_list_exclusions(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.ListExclusionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_exclusions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListExclusions_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py deleted file mode 100755 index a73457c02e4a..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_list_links(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.ListLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListLinks_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py deleted file mode 100755 index b349cd2b837f..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_list_links(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.ListLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListLinks_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py deleted file mode 100755 index c10f027ed91a..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListSinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_list_sinks(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.ListSinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_sinks(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListSinks_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py deleted file mode 100755 index d3f694adc029..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListSinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_list_sinks(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.ListSinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_sinks(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListSinks_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py deleted file mode 100755 index bec578a8c629..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListViews -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListViews_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_list_views(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.ListViewsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_views(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListViews_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py deleted file mode 100755 index 726d8e17aa01..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListViews -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_ListViews_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_list_views(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.ListViewsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_views(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END logging_v2_generated_ConfigServiceV2_ListViews_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py deleted file mode 100755 index 80d4eec6bd06..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCmekSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_update_cmek_settings(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.UpdateCmekSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.update_cmek_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py deleted file mode 100755 index f0d2fec56eb0..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCmekSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_update_cmek_settings(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.UpdateCmekSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.update_cmek_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py deleted file mode 100755 index 862c4f56240a..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_update_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - exclusion = logging_v2.LogExclusion() - exclusion.name = "name_value" - exclusion.filter = "filter_value" - - request = logging_v2.UpdateExclusionRequest( - name="name_value", - exclusion=exclusion, - ) - - # Make the request - response = await client.update_exclusion(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py deleted file mode 100755 index c9d932be084e..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateExclusion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_update_exclusion(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - exclusion = logging_v2.LogExclusion() - exclusion.name = "name_value" - exclusion.filter = "filter_value" - - request = logging_v2.UpdateExclusionRequest( - name="name_value", - exclusion=exclusion, - ) - - # Make the request - response = client.update_exclusion(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py deleted file mode 100755 index add426ab48d7..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_update_settings(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.UpdateSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.update_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateSettings_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py deleted file mode 100755 index 3c6ae06710ce..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_update_settings(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.UpdateSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.update_settings(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateSettings_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py deleted file mode 100755 index 029bc692a146..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_update_sink(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - sink = logging_v2.LogSink() - sink.name = "name_value" - sink.destination = "destination_value" - - request = logging_v2.UpdateSinkRequest( - sink_name="sink_name_value", - sink=sink, - ) - - # Make the request - response = await client.update_sink(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateSink_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py deleted file mode 100755 index 1cd230a4d4f9..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateSink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_update_sink(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - sink = logging_v2.LogSink() - sink.name = "name_value" - sink.destination = "destination_value" - - request = logging_v2.UpdateSinkRequest( - sink_name="sink_name_value", - sink=sink, - ) - - # Make the request - response = client.update_sink(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateSink_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py deleted file mode 100755 index bc475e8f1a36..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateView_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_update_view(): - # Create a client - client = logging_v2.ConfigServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.UpdateViewRequest( - name="name_value", - ) - - # Make the request - response = await client.update_view(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateView_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py deleted file mode 100755 index 618f1739cc93..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateView -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_ConfigServiceV2_UpdateView_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_update_view(): - # Create a client - client = logging_v2.ConfigServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.UpdateViewRequest( - name="name_value", - ) - - # Make the request - response = client.update_view(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_ConfigServiceV2_UpdateView_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py deleted file mode 100755 index 27937e73f86d..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_create_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2AsyncClient() - - # Initialize request argument(s) - metric = logging_v2.LogMetric() - metric.name = "name_value" - metric.filter = "filter_value" - - request = logging_v2.CreateLogMetricRequest( - parent="parent_value", - metric=metric, - ) - - # Make the request - response = await client.create_log_metric(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py deleted file mode 100755 index bac12f350ec4..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_create_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2Client() - - # Initialize request argument(s) - metric = logging_v2.LogMetric() - metric.name = "name_value" - metric.filter = "filter_value" - - request = logging_v2.CreateLogMetricRequest( - parent="parent_value", - metric=metric, - ) - - # Make the request - response = client.create_log_metric(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py deleted file mode 100755 index f5a7e482a45a..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_delete_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.DeleteLogMetricRequest( - metric_name="metric_name_value", - ) - - # Make the request - await client.delete_log_metric(request=request) - - -# [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py deleted file mode 100755 index 7c07c79f6a1c..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_delete_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.DeleteLogMetricRequest( - metric_name="metric_name_value", - ) - - # Make the request - client.delete_log_metric(request=request) - - -# [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py deleted file mode 100755 index a58c0902d6a6..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_get_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.GetLogMetricRequest( - metric_name="metric_name_value", - ) - - # Make the request - response = await client.get_log_metric(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_MetricsServiceV2_GetLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py deleted file mode 100755 index 566b5ddbabd1..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_GetLogMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_get_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.GetLogMetricRequest( - metric_name="metric_name_value", - ) - - # Make the request - response = client.get_log_metric(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_MetricsServiceV2_GetLogMetric_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py deleted file mode 100755 index 332fa974fe90..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListLogMetrics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_list_log_metrics(): - # Create a client - client = logging_v2.MetricsServiceV2AsyncClient() - - # Initialize request argument(s) - request = logging_v2.ListLogMetricsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_log_metrics(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py deleted file mode 100755 index 2206611ef882..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListLogMetrics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_list_log_metrics(): - # Create a client - client = logging_v2.MetricsServiceV2Client() - - # Initialize request argument(s) - request = logging_v2.ListLogMetricsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_log_metrics(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_sync] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py deleted file mode 100755 index 7ac109f2a37f..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -async def sample_update_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2AsyncClient() - - # Initialize request argument(s) - metric = logging_v2.LogMetric() - metric.name = "name_value" - metric.filter = "filter_value" - - request = logging_v2.UpdateLogMetricRequest( - metric_name="metric_name_value", - metric=metric, - ) - - # Make the request - response = await client.update_log_metric(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py deleted file mode 100755 index 666714c20bd1..000000000000 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateLogMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-logging - - -# [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import logging_v2 - - -def sample_update_log_metric(): - # Create a client - client = logging_v2.MetricsServiceV2Client() - - # Initialize request argument(s) - metric = logging_v2.LogMetric() - metric.name = "name_value" - metric.filter = "filter_value" - - request = logging_v2.UpdateLogMetricRequest( - metric_name="metric_name_value", - metric=metric, - ) - - # Make the request - response = client.update_log_metric(request=request) - - # Handle the response - print(response) - -# [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync] From cbb69219c0c71273d5a3eabb6a2f4053dfdd5bf3 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 20:34:05 -0400 Subject: [PATCH 19/28] refactor(gapic-generator): warning-free and leak-proof asyncio event loop autouse fixture inside tests template --- .../gapic/templates/testing/constraints-3.14.txt.j2 | 1 - .../unit/gapic/%name_%version/%sub/test_%service.py.j2 | 8 +++++++- .../goldens/asset/testing/constraints-3.14.txt | 1 - .../asset/tests/unit/gapic/asset_v1/test_asset_service.py | 8 +++++++- .../goldens/credentials/testing/constraints-3.14.txt | 1 - .../unit/gapic/credentials_v1/test_iam_credentials.py | 8 +++++++- .../goldens/eventarc/testing/constraints-3.14.txt | 1 - .../tests/unit/gapic/eventarc_v1/test_eventarc.py | 8 +++++++- .../goldens/logging/testing/constraints-3.14.txt | 1 - .../tests/unit/gapic/logging_v2/test_config_service_v2.py | 8 +++++++- .../unit/gapic/logging_v2/test_logging_service_v2.py | 8 +++++++- .../unit/gapic/logging_v2/test_metrics_service_v2.py | 8 +++++++- .../goldens/logging_internal/testing/constraints-3.14.txt | 1 - .../tests/unit/gapic/logging_v2/test_config_service_v2.py | 8 +++++++- .../unit/gapic/logging_v2/test_logging_service_v2.py | 8 +++++++- .../unit/gapic/logging_v2/test_metrics_service_v2.py | 8 +++++++- .../goldens/redis/testing/constraints-3.14.txt | 1 - .../redis/tests/unit/gapic/redis_v1/test_cloud_redis.py | 8 +++++++- .../goldens/redis_selective/testing/constraints-3.14.txt | 1 - .../tests/unit/gapic/redis_v1/test_cloud_redis.py | 8 +++++++- .../storagebatchoperations/testing/constraints-3.14.txt | 1 - .../test_storage_batch_operations.py | 8 +++++++- 22 files changed, 91 insertions(+), 22 deletions(-) diff --git a/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 b/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 index 62d737cc72e1..c2e7b8a9934c 100644 --- a/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 +++ b/packages/gapic-generator/gapic/templates/testing/constraints-3.14.txt.j2 @@ -11,7 +11,6 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 {% for package_tuple, package_info in pypi_packages.items() %} {# Quick check to make sure `package_info.package_name` is not the package being generated so we don't circularly include this package in its own constraints file. #} {% if api.naming.warehouse_package_name != package_info.package_name %} diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index ef6def89d8c3..112433053adc 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -144,10 +144,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt index 8490ada86745..c3db09a0c746 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.14.txt @@ -10,7 +10,6 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 google-cloud-access-context-manager>=0 google-cloud-os-config>=1 grpc-google-iam-v1>=0 diff --git a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py index 520a7743d90d..915bdfa0803c 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -109,10 +109,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt index e483793733f2..1e93c60e50aa 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.14.txt @@ -10,4 +10,3 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py index 20e9b27ad075..38a5ea6f2d0e 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py @@ -99,10 +99,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt index db44cc0adec9..2ae5a677e852 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.14.txt @@ -10,5 +10,4 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 grpc-google-iam-v1>=0 diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index e06e9f277fa1..0234a2e7eda4 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py @@ -130,10 +130,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt index e483793733f2..1e93c60e50aa 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.14.txt @@ -10,4 +10,3 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index bd1f6774c8fb..5bf981bbeef8 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -100,10 +100,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 392b1a3e2703..5e46e7d7cbed 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -101,10 +101,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index ac94c1a8577e..607a5e4582d5 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -99,10 +99,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt index e483793733f2..1e93c60e50aa 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.14.txt @@ -10,4 +10,3 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py index 159ce28b2069..0adf5da9ca8d 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -100,10 +100,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 392b1a3e2703..5e46e7d7cbed 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -101,10 +101,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 4d72e7245166..bad3add4b8b1 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -99,10 +99,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt index e483793733f2..1e93c60e50aa 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.14.txt @@ -10,4 +10,3 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index c70a998f17da..3f9d38dac502 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -117,10 +117,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt index e483793733f2..1e93c60e50aa 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.14.txt @@ -10,4 +10,3 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py index 08cc96474eab..fb8f236fa6fc 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -117,10 +117,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt index e483793733f2..1e93c60e50aa 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.14.txt @@ -10,4 +10,3 @@ google-auth>=2 grpcio>=1 proto-plus>=1 protobuf>=6 -pytest-asyncio>=1.3.0 diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index dac7e5280939..840cc552dd6e 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py @@ -109,10 +109,16 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop() + asyncio.get_event_loop_policy().get_event_loop() + yield except RuntimeError: loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) def test__get_default_mtls_endpoint(): From fbc98140988b59273c4d85d6a2cab5464ff5a2ac Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 21:07:06 -0400 Subject: [PATCH 20/28] refactor(gapic-generator): use asyncio.get_running_loop() in test template to prevent Python 3.16 deprecation warnings --- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- .../asset/tests/unit/gapic/asset_v1/test_asset_service.py | 2 +- .../tests/unit/gapic/credentials_v1/test_iam_credentials.py | 2 +- .../eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py | 2 +- .../tests/unit/gapic/logging_v2/test_config_service_v2.py | 2 +- .../tests/unit/gapic/logging_v2/test_logging_service_v2.py | 2 +- .../tests/unit/gapic/logging_v2/test_metrics_service_v2.py | 2 +- .../tests/unit/gapic/logging_v2/test_config_service_v2.py | 2 +- .../tests/unit/gapic/logging_v2/test_logging_service_v2.py | 2 +- .../tests/unit/gapic/logging_v2/test_metrics_service_v2.py | 2 +- .../goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py | 2 +- .../tests/unit/gapic/redis_v1/test_cloud_redis.py | 2 +- .../storagebatchoperations_v1/test_storage_batch_operations.py | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 112433053adc..fcbeeff213b5 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -144,7 +144,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py index 915bdfa0803c..5b742aba935a 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -109,7 +109,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py index 38a5ea6f2d0e..6cf5dca6bfb0 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py @@ -99,7 +99,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index 0234a2e7eda4..c39b30af0310 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py @@ -130,7 +130,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index 5bf981bbeef8..70f2b1ee57de 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -100,7 +100,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 5e46e7d7cbed..d17295af4442 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -101,7 +101,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 607a5e4582d5..44f71aaf1ecc 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -99,7 +99,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py index 0adf5da9ca8d..6d3e18c4acdc 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -100,7 +100,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 5e46e7d7cbed..d17295af4442 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -101,7 +101,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index bad3add4b8b1..d7d864d25978 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -99,7 +99,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 3f9d38dac502..0ded4d75fab1 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -117,7 +117,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py index fb8f236fa6fc..d29546120e42 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -117,7 +117,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index 840cc552dd6e..15d53645f43d 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py @@ -109,7 +109,7 @@ def modify_default_endpoint_template(client): @pytest.fixture(autouse=True) def set_event_loop(): try: - asyncio.get_event_loop_policy().get_event_loop() + asyncio.get_running_loop() yield except RuntimeError: loop = asyncio.new_event_loop() From 5acd9e4116bacc72bd3750722ed1f6abee215dd4 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Tue, 26 May 2026 21:46:31 -0400 Subject: [PATCH 21/28] refactor(logging): regenerate logging package with warning-free event loops and version-proof post-processor --- .../logging-integration.yaml | 4 ++-- packages/google-cloud-logging/noxfile.py | 14 +++++++------- packages/google-cloud-logging/setup.py | 2 +- .../testing/constraints-3.10.txt | 2 +- .../gapic/logging_v2/test_config_service_v2.py | 16 ++++++++++++++++ .../gapic/logging_v2/test_logging_service_v2.py | 16 ++++++++++++++++ .../gapic/logging_v2/test_metrics_service_v2.py | 16 ++++++++++++++++ 7 files changed, 59 insertions(+), 11 deletions(-) diff --git a/.librarian/generator-input/client-post-processing/logging-integration.yaml b/.librarian/generator-input/client-post-processing/logging-integration.yaml index 6b32d5db3f3d..8ebed3fcce7e 100644 --- a/.librarian/generator-input/client-post-processing/logging-integration.yaml +++ b/.librarian/generator-input/client-post-processing/logging-integration.yaml @@ -38,7 +38,7 @@ replacements: ] before: | "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", - \ "grpcio >= 1.44.0, < 2.0.0", + \ "grpcio >= 1.59.0, < 2.0.0", after: | "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-appengine-logging>=0.1.3, <2.0.0", @@ -46,7 +46,7 @@ replacements: "google-cloud-core >= 2.0.0, <3.0.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", "opentelemetry-api >= 1.16.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ "packages/google-cloud-logging/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py", diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index 0d735fe174f4..fe52995013b6 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -47,9 +47,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -LOWER_BOUND_CONSTRAINTS_FILE = ( - CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" -) +if (CURRENT_DIRECTORY / "testing").exists(): + LOWER_BOUND_CONSTRAINTS_FILE = ( + CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" + ) +else: + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -57,10 +60,7 @@ "asyncmock", "pytest", "pytest-cov", - # Pin pytest-asyncio to 0.23.8 to avoid strict event loop regressions - # in newer versions (v0.24+) which conflict with older grpcio (1.44.0) - # that does not automatically initialize loops in synchronous test threads. - "pytest-asyncio==0.23.8", + "pytest-asyncio", ] UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = [ "flask", diff --git a/packages/google-cloud-logging/setup.py b/packages/google-cloud-logging/setup.py index c32b70772af9..97568c52429b 100644 --- a/packages/google-cloud-logging/setup.py +++ b/packages/google-cloud-logging/setup.py @@ -48,7 +48,7 @@ "google-cloud-core >= 2.0.0, <3.0.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", "opentelemetry-api >= 1.16.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -6,6 +6,6 @@ # then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index b4ded2e4b7af..f4800c87b39d 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import json import math import os @@ -112,6 +113,21 @@ def modify_default_endpoint_template(client): ) +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_running_loop() + yield + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 15fc2e936161..2515b0b5aaf5 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import json import math import os @@ -112,6 +113,21 @@ def modify_default_endpoint_template(client): ) +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_running_loop() + yield + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 51904674ac2a..541ed0e7657c 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import asyncio import json import math import os @@ -111,6 +112,21 @@ def modify_default_endpoint_template(client): ) +@pytest.fixture(autouse=True) +def set_event_loop(): + try: + asyncio.get_running_loop() + yield + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + try: + yield + finally: + loop.close() + asyncio.set_event_loop(None) + + def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" From 26237c6193eaca31cdc780acd44cb6aa1b5cf17b Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 05:09:29 -0400 Subject: [PATCH 22/28] revert(logging): restore packages/gapic-generator to main --- .../%name_%version/%sub/test_%service.py.j2 | 9 +- .../gapic/generator/generator.py | 3 + .../%sub/services/%service/_shared_macros.j2 | 10 +- .../%sub/services/%service/async_client.py.j2 | 2 +- .../%sub/services/%service/client.py.j2 | 32 + .../%name_%version/%sub/test_%service.py.j2 | 81 ++ .../gapic/%name_%version/%sub/test_macros.j2 | 113 +- .../gapic-generator/gapic/utils/__init__.py | 2 + packages/gapic-generator/setup.py | 2 +- .../unit/gapic/asset_v1/test_asset_service.py | 621 +++++----- .../credentials_v1/test_iam_credentials.py | 108 +- .../unit/gapic/eventarc_v1/test_eventarc.py | 1053 ++++++++--------- .../logging_v2/test_config_service_v2.py | 832 ++++++------- .../logging_v2/test_logging_service_v2.py | 152 +-- .../logging_v2/test_metrics_service_v2.py | 130 +- .../logging_v2/test_config_service_v2.py | 832 ++++++------- .../logging_v2/test_logging_service_v2.py | 152 +-- .../logging_v2/test_metrics_service_v2.py | 130 +- .../unit/gapic/redis_v1/test_cloud_redis.py | 308 +++-- .../unit/gapic/redis_v1/test_cloud_redis.py | 140 +-- .../storage_batch_operations/async_client.py | 9 +- .../storage_batch_operations/client.py | 39 +- .../test_storage_batch_operations.py | 386 +++--- 23 files changed, 2607 insertions(+), 2539 deletions(-) diff --git a/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 8f0bf28f7416..e8953eb0742e 100644 --- a/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -70,8 +70,10 @@ from google.iam.v1 import policy_pb2 # type: ignore {% endfilter %} {{ shared_macros.add_google_api_core_version_header_import(service.version) }} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} +_UUID4_RE = re.compile(r"{{ uuid4_re }}") +{% endif %} -{% with uuid4_re = "[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" %} def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -692,7 +694,7 @@ def test_{{ method_name }}_empty_call(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) + assert _UUID4_RE.match(args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -730,7 +732,7 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) + assert _UUID4_RE.match(args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -2488,5 +2490,4 @@ def test_client_ctx(): pass close.assert_called() -{% endwith %}{# uuid4_re #} {% endblock %} diff --git a/packages/gapic-generator/gapic/generator/generator.py b/packages/gapic-generator/gapic/generator/generator.py index e9e006e74884..9fe56aa9de1d 100644 --- a/packages/gapic-generator/gapic/generator/generator.py +++ b/packages/gapic-generator/gapic/generator/generator.py @@ -75,6 +75,9 @@ def __init__(self, opts: Options) -> None: self._env.tests["str_field_pb"] = utils.is_str_field_pb self._env.tests["msg_field_pb"] = utils.is_msg_field_pb + # Add global variables. + self._env.globals["uuid4_re"] = utils.UUID4_RE + self._sample_configs = opts.sample_configs def get_response(self, api_schema: api.API, opts: Options) -> CodeGeneratorResponse: diff --git a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 index 81c9a11a07e4..755e4530e7ba 100644 --- a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 +++ b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2 @@ -14,7 +14,7 @@ # limitations under the License. #} -{% macro auto_populate_uuid4_fields(api, method) %} +{% macro auto_populate_uuid4_fields(api, method, is_async=False) %} {# Automatically populate UUID4 fields according to https://google.aip.dev/client-libraries/4235 when the @@ -27,12 +27,12 @@ {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} - {% if method.input.fields[auto_populated_field].proto3_optional %} - if '{{ auto_populated_field }}' not in request: + {% set is_proto3_optional = method.input.fields[auto_populated_field].proto3_optional %} + {% if is_async %} + self._client._setup_request_id(request, '{{ auto_populated_field }}', {{ is_proto3_optional }}) {% else %} - if not request.{{ auto_populated_field }}: + self._setup_request_id(request, '{{ auto_populated_field }}', {{ is_proto3_optional }}) {% endif %} - request.{{ auto_populated_field }} = str(uuid.uuid4()) {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} diff --git a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 2865a61657e6..6e604b035141 100644 --- a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -395,7 +395,7 @@ class {{ service.async_client_name }}: {{ shared_macros.create_metadata(method) }} {{ shared_macros.add_api_version_header_to_metadata(service.version) }} -{{ shared_macros.auto_populate_uuid4_fields(api, method) }} +{{ shared_macros.auto_populate_uuid4_fields(api, method, is_async=True) }} # Validate the universe domain. self._client._validate_universe_domain() diff --git a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index 078d6862beae..2579d0dcf2fd 100644 --- a/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -453,6 +453,38 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): # NOTE (b/349488459): universe validation is disabled until further notice. return True + {% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} + @staticmethod + def _setup_request_id(request, field_name: str, is_proto3_optional: bool): + """Populate a UUID4 field in the request if it is not already set. + + Args: + request (Union[google.protobuf.message.Message, dict]): The request object. + field_name (str): The name of the field to populate. + is_proto3_optional (bool): Whether the field is proto3 optional. + """ + if isinstance(request, dict): + if is_proto3_optional: + if field_name not in request: + request[field_name] = str(uuid.uuid4()) + elif not request.get(field_name): + request[field_name] = str(uuid.uuid4()) + return + + if is_proto3_optional: + try: + # Pure protobuf messages + if not request.HasField(field_name): + setattr(request, field_name, str(uuid.uuid4())) + except (AttributeError, ValueError): + # Proto-plus messages or other objects + if field_name not in request: + setattr(request, field_name, str(uuid.uuid4())) + else: + if not getattr(request, field_name): + setattr(request, field_name, str(uuid.uuid4())) + {% endif %} + def _add_cred_info_for_auth_errors( self, error: core_exceptions.GoogleAPICallError diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 4e802a614456..fcbeeff213b5 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -107,6 +107,9 @@ CRED_INFO_JSON = { "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} +_UUID4_RE = re.compile(r"{{ uuid4_re }}") +{% endif %} async def mock_async_gen(data, chunk_size=1): @@ -431,6 +434,84 @@ def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): client._add_cred_info_for_auth_errors(error) assert error.details == [] +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} +def test__setup_request_id(): + class MockRequest: + def __init__(self, **kwargs): + for k, v in kwargs.items(): + setattr(self, k, v) + def __contains__(self, key): + return hasattr(self, key) + + class MockProtoRequest: + def __init__(self, **kwargs): + for k, v in kwargs.items(): + setattr(self, k, v) + def HasField(self, key): + return hasattr(self, key) + + # Test with proto3 optional field not in request + request = MockRequest() + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) + + # Test with proto3 optional field already in request + request = MockRequest(request_id="already_set") + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert request.request_id == "already_set" + + # Test with non-proto3 optional field empty + request = MockRequest(request_id="") + {{ service.client_name }}._setup_request_id(request, "request_id", False) + assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) + + # Test with non-proto3 optional field already set + request = MockRequest(request_id="already_set") + {{ service.client_name }}._setup_request_id(request, "request_id", False) + assert request.request_id == "already_set" + + # Test with proto3 optional field not in request (MockProtoRequest) + request = MockProtoRequest() + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) + + # Test with proto3 optional field already in request (MockProtoRequest) + request = MockProtoRequest(request_id="already_set") + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert request.request_id == "already_set" + + # Test with ValueError + class MockValueErrorRequest: + def HasField(self, key): + raise ValueError("Mismatched field") + def __contains__(self, key): + return hasattr(self, key) + + request = MockValueErrorRequest() + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert re.match(r"{{ test_macros.get_uuid4_re() }}", request.request_id) + + # Test with dict and proto3 optional field not in request + request = {} + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert re.match(r"{{ test_macros.get_uuid4_re() }}", request["request_id"]) + + # Test with dict and proto3 optional field already in request + request = {"request_id": "already_set"} + {{ service.client_name }}._setup_request_id(request, "request_id", True) + assert request["request_id"] == "already_set" + + # Test with dict and non-proto3 optional field empty + request = {"request_id": ""} + {{ service.client_name }}._setup_request_id(request, "request_id", False) + assert re.match(r"{{ test_macros.get_uuid4_re() }}", request["request_id"]) + + # Test with dict and non-proto3 optional field already set + request = {"request_id": "already_set"} + {{ service.client_name }}._setup_request_id(request, "request_id", False) + assert request["request_id"] == "already_set" + +{% endif %} @pytest.mark.parametrize("client_class,transport_name", [ {% if 'grpc' in opts.transport %} ({{ service.client_name }}, "grpc"), diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 index 9e3f4be26b13..648f2e868812 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 @@ -1,11 +1,21 @@ {% macro grpc_required_tests(method, service, api, full_extended_lro=False) %} +{%- set method_settings = api.all_method_settings.get(method.meta.address.proto) -%} +{%- set auto_populated_fields = method_settings.auto_populated_fields if method_settings else [] -%} +{%- set auto_populated_field_sample_value = "explicit value for autopopulate-able field" -%} {% with method_name = method.client_method_name|snake_case + "_unary" if method.extended_lro and not full_extended_lro else method.client_method_name|snake_case, method_output = method.extended_lro.operation_type if method.extended_lro and not full_extended_lro else method.output %} @pytest.mark.parametrize("request_type", [ - {{ method.input.ident }}, - dict, + {{ method.input.ident }}({ + {% for auto_populated_field in auto_populated_fields %} + "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", + {% endfor %} + }), + { + {% for auto_populated_field in auto_populated_fields %} + "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", + {% endfor %} + }, ]) def test_{{ method_name }}(request_type, transport: str = 'grpc'): - {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} client = {{ service.client_name }}( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -13,18 +23,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - {# Set UUID4 fields so that they are not automatically populated. #} - {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} - {% if method_settings is not none %} - {% for auto_populated_field in method_settings.auto_populated_fields %} - if isinstance(request, dict): - request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" - else: - request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" - {% endfor %} - {% endif %}{# if method_settings is not none #} - {% endwith %}{# method_settings #} + request = request_type {% if method.client_streaming %} requests = [request] {% endif %} @@ -71,13 +70,9 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): assert next(args[0]) == request {% else %} request = {{ method.input.ident }}() - {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} - {% if method_settings is not none %} - {% for auto_populated_field in method_settings.auto_populated_fields %} + {% for auto_populated_field in auto_populated_fields %} request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} - {% endif %}{# if method_settings is not none #} - {% endwith %}{# method_settings #} assert args[0] == request {% endif %} @@ -118,10 +113,9 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% endif %}{# end oneof/optional #} {% endfor %} {% endif %} - {% endwith %}{# auto_populated_field_sample_value #} + {%- if not method.client_streaming %} -{% if not method.client_streaming %} def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. @@ -148,20 +142,20 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): call.assert_called() _, args, _ = call.mock_calls[0] {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + request_msg = {{ method.input.ident }}( + {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} + {{ field.name }}={{ field.mock_value }}, + {% endfor %} + ) {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) - # clear UUID field so that the check below succeeds - args[0].{{ auto_populated_field }} = None + assert _UUID4_RE.fullmatch(args[0].{{ auto_populated_field }}) + request_msg.{{ auto_populated_field }} = args[0].{{ auto_populated_field }} {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} - assert args[0] == {{ method.input.ident }}( - {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} - {{ field.name }}={{ field.mock_value }}, - {% endfor %} - ) + assert args[0] == request_msg {% endif %} def test_{{ method_name }}_use_cached_wrapped_rpc(): @@ -265,8 +259,19 @@ async def test_{{ method_name }}_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_type={{ method.input.ident }}): - {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} +@pytest.mark.parametrize("request_type", [ + {{ method.input.ident }}({ + {%- for auto_populated_field in auto_populated_fields %} + "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", + {%- endfor %} + }), + { + {%- for auto_populated_field in auto_populated_fields %} + "{{ auto_populated_field }}": "{{ auto_populated_field_sample_value }}", + {%- endfor %} + }, +]) +async def test_{{ method_name }}_async(request_type, transport: str = 'grpc_asyncio'): client = {{ service.async_client_name }}( credentials=async_anonymous_credentials(), transport=transport, @@ -274,18 +279,7 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - {# Set UUID4 fields so that they are not automatically populated. #} - {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} - {% if method_settings is not none %} - {% for auto_populated_field in method_settings.auto_populated_fields %} - if isinstance(request, dict): - request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" - else: - request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" - {% endfor %} - {% endif %}{# if method_settings is not none #} - {% endwith %}{# method_settings #} + request = request_type {% if method.client_streaming %} requests = [request] {% endif %} @@ -335,13 +329,9 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ assert next(args[0]) == request {% else %} request = {{ method.input.ident }}() - {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} - {% if method_settings is not none %} - {% for auto_populated_field in method_settings.auto_populated_fields %} + {% for auto_populated_field in auto_populated_fields %} request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} - {% endif %}{# if method_settings is not none #} - {% endwith %}{# method_settings #} assert args[0] == request {% endif %} @@ -378,12 +368,6 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ {% endif %}{# oneof/optional #} {% endfor %} {% endif %} - {% endwith %}{# auto_populated_field_sample_value #} - - -@pytest.mark.asyncio -async def test_{{ method_name }}_async_from_dict(): - await test_{{ method_name }}_async(request_type=dict) {% endif %}{# full_extended_lro #} {% if method.field_headers and not method.client_streaming and not method.explicit_routing %} @@ -1224,7 +1208,7 @@ def test_{{ method_name }}_rest_required_fields(request_type={{ method.input.ide # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "{{ auto_populated_field|camel_case }}": - assert re.fullmatch(r"{{ get_uuid4_re() }}", value) + assert _UUID4_RE.match(value) break # Include {{ auto_populated_field|camel_case }} within expected_params with value mock.ANY @@ -1572,21 +1556,20 @@ def test_{{ method_name }}_rest_no_http_options(): # Establish that the underlying stub method was called. call.assert_called() _, args, {% if routing_param %}kw{% else %}_{% endif %} = call.mock_calls[0] + {% if request_dict %} + request_msg = {{ method.input.ident }}(**{{ request_dict }}) + {% else %} + request_msg = {{ method.input.ident }}() + {% endif %}{# request_dict #} {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"{{ get_uuid4_re() }}", args[0].{{ auto_populated_field }}) - # clear UUID field so that the check below succeeds - args[0].{{ auto_populated_field }} = None + assert _UUID4_RE.fullmatch(args[0].{{ auto_populated_field }}) + request_msg.{{ auto_populated_field }} = args[0].{{ auto_populated_field }} {% endfor %}{# for auto_populated_field in method_settings.auto_populated_fields #} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} - {% if request_dict %} - request_msg = {{ method.input.ident }}(**{{ request_dict }}) - {% else %} - request_msg = {{ method.input.ident }}() - {% endif %}{# request_dict #} assert args[0] == request_msg {% if routing_param %} @@ -2213,7 +2196,7 @@ def test_initialize_client_w_{{transport_name}}(): {% endmacro %}{# empty_call_test #} {% macro get_uuid4_re() -%} -[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12} +{{ uuid4_re }} {%- endmacro %}{# uuid_re #} {% macro routing_parameter_test(service, api, transport, is_async) %} diff --git a/packages/gapic-generator/gapic/utils/__init__.py b/packages/gapic-generator/gapic/utils/__init__.py index 23c573915695..18d78c31dd1e 100644 --- a/packages/gapic-generator/gapic/utils/__init__.py +++ b/packages/gapic-generator/gapic/utils/__init__.py @@ -22,6 +22,7 @@ from gapic.utils.code import nth from gapic.utils.code import partition from gapic.utils.code import make_private +from gapic.utils.constants import UUID4_RE from gapic.utils.doc import doc from gapic.utils.filename import to_valid_filename from gapic.utils.filename import to_valid_module_name @@ -52,5 +53,6 @@ "to_camel_case", "to_valid_filename", "to_valid_module_name", + "UUID4_RE", "wrap", ) diff --git a/packages/gapic-generator/setup.py b/packages/gapic-generator/setup.py index 3e9afad5fefe..41c08ae8a4a9 100644 --- a/packages/gapic-generator/setup.py +++ b/packages/gapic-generator/setup.py @@ -21,7 +21,7 @@ name = "gapic-generator" description = "Google API Client Generator for Python" -url = "https://github.com/googleapis/gapic-generator-python" +url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/gapic-generator" version = "1.33.0" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ diff --git a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py index 87c166891b97..5b742aba935a 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -981,8 +981,10 @@ def test_asset_service_client_create_channel_credentials_file(client_class, tran @pytest.mark.parametrize("request_type", [ - asset_service.ExportAssetsRequest, - dict, + asset_service.ExportAssetsRequest({ + }), + { + }, ]) def test_export_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -992,7 +994,7 @@ def test_export_assets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1035,9 +1037,10 @@ def test_export_assets_non_empty_request_with_auto_populated_field(): client.export_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ExportAssetsRequest( + request_msg = asset_service.ExportAssetsRequest( parent='parent_value', ) + assert args[0] == request_msg def test_export_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1116,7 +1119,11 @@ async def test_export_assets_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_export_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.ExportAssetsRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.ExportAssetsRequest({ }), + { }, +]) +async def test_export_assets_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1124,7 +1131,7 @@ async def test_export_assets_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1145,11 +1152,6 @@ async def test_export_assets_async(transport: str = 'grpc_asyncio', request_type # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_export_assets_async_from_dict(): - await test_export_assets_async(request_type=dict) - def test_export_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1214,8 +1216,10 @@ async def test_export_assets_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.ListAssetsRequest, - dict, + asset_service.ListAssetsRequest({ + }), + { + }, ]) def test_list_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -1225,7 +1229,7 @@ def test_list_assets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1272,10 +1276,11 @@ def test_list_assets_non_empty_request_with_auto_populated_field(): client.list_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListAssetsRequest( + request_msg = asset_service.ListAssetsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1344,7 +1349,11 @@ async def test_list_assets_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListAssetsRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.ListAssetsRequest({ }), + { }, +]) +async def test_list_assets_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1352,7 +1361,7 @@ async def test_list_assets_async(transport: str = 'grpc_asyncio', request_type=a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1374,11 +1383,6 @@ async def test_list_assets_async(transport: str = 'grpc_asyncio', request_type=a assert isinstance(response, pagers.ListAssetsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_assets_async_from_dict(): - await test_list_assets_async(request_type=dict) - def test_list_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1719,8 +1723,10 @@ async def test_list_assets_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.BatchGetAssetsHistoryRequest, - dict, + asset_service.BatchGetAssetsHistoryRequest({ + }), + { + }, ]) def test_batch_get_assets_history(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -1730,7 +1736,7 @@ def test_batch_get_assets_history(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1774,9 +1780,10 @@ def test_batch_get_assets_history_non_empty_request_with_auto_populated_field(): client.batch_get_assets_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.BatchGetAssetsHistoryRequest( + request_msg = asset_service.BatchGetAssetsHistoryRequest( parent='parent_value', ) + assert args[0] == request_msg def test_batch_get_assets_history_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1845,7 +1852,11 @@ async def test_batch_get_assets_history_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_batch_get_assets_history_async(transport: str = 'grpc_asyncio', request_type=asset_service.BatchGetAssetsHistoryRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.BatchGetAssetsHistoryRequest({ }), + { }, +]) +async def test_batch_get_assets_history_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1853,7 +1864,7 @@ async def test_batch_get_assets_history_async(transport: str = 'grpc_asyncio', r # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1873,11 +1884,6 @@ async def test_batch_get_assets_history_async(transport: str = 'grpc_asyncio', r # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetAssetsHistoryResponse) - -@pytest.mark.asyncio -async def test_batch_get_assets_history_async_from_dict(): - await test_batch_get_assets_history_async(request_type=dict) - def test_batch_get_assets_history_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1942,8 +1948,10 @@ async def test_batch_get_assets_history_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.CreateFeedRequest, - dict, + asset_service.CreateFeedRequest({ + }), + { + }, ]) def test_create_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -1953,7 +1961,7 @@ def test_create_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2008,10 +2016,11 @@ def test_create_feed_non_empty_request_with_auto_populated_field(): client.create_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.CreateFeedRequest( + request_msg = asset_service.CreateFeedRequest( parent='parent_value', feed_id='feed_id_value', ) + assert args[0] == request_msg def test_create_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2080,7 +2089,11 @@ async def test_create_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.CreateFeedRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.CreateFeedRequest({ }), + { }, +]) +async def test_create_feed_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2088,7 +2101,7 @@ async def test_create_feed_async(transport: str = 'grpc_asyncio', request_type=a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2118,11 +2131,6 @@ async def test_create_feed_async(transport: str = 'grpc_asyncio', request_type=a assert response.content_type == asset_service.ContentType.RESOURCE assert response.relationship_types == ['relationship_types_value'] - -@pytest.mark.asyncio -async def test_create_feed_async_from_dict(): - await test_create_feed_async(request_type=dict) - def test_create_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2269,8 +2277,10 @@ async def test_create_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.GetFeedRequest, - dict, + asset_service.GetFeedRequest({ + }), + { + }, ]) def test_get_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -2280,7 +2290,7 @@ def test_get_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2334,9 +2344,10 @@ def test_get_feed_non_empty_request_with_auto_populated_field(): client.get_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.GetFeedRequest( + request_msg = asset_service.GetFeedRequest( name='name_value', ) + assert args[0] == request_msg def test_get_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2405,7 +2416,11 @@ async def test_get_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.GetFeedRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.GetFeedRequest({ }), + { }, +]) +async def test_get_feed_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2413,7 +2428,7 @@ async def test_get_feed_async(transport: str = 'grpc_asyncio', request_type=asse # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2443,11 +2458,6 @@ async def test_get_feed_async(transport: str = 'grpc_asyncio', request_type=asse assert response.content_type == asset_service.ContentType.RESOURCE assert response.relationship_types == ['relationship_types_value'] - -@pytest.mark.asyncio -async def test_get_feed_async_from_dict(): - await test_get_feed_async(request_type=dict) - def test_get_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2594,8 +2604,10 @@ async def test_get_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.ListFeedsRequest, - dict, + asset_service.ListFeedsRequest({ + }), + { + }, ]) def test_list_feeds(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -2605,7 +2617,7 @@ def test_list_feeds(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2649,9 +2661,10 @@ def test_list_feeds_non_empty_request_with_auto_populated_field(): client.list_feeds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListFeedsRequest( + request_msg = asset_service.ListFeedsRequest( parent='parent_value', ) + assert args[0] == request_msg def test_list_feeds_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2720,7 +2733,11 @@ async def test_list_feeds_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_feeds_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListFeedsRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.ListFeedsRequest({ }), + { }, +]) +async def test_list_feeds_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2728,7 +2745,7 @@ async def test_list_feeds_async(transport: str = 'grpc_asyncio', request_type=as # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2748,11 +2765,6 @@ async def test_list_feeds_async(transport: str = 'grpc_asyncio', request_type=as # Establish that the response is the type that we expect. assert isinstance(response, asset_service.ListFeedsResponse) - -@pytest.mark.asyncio -async def test_list_feeds_async_from_dict(): - await test_list_feeds_async(request_type=dict) - def test_list_feeds_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2899,8 +2911,10 @@ async def test_list_feeds_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.UpdateFeedRequest, - dict, + asset_service.UpdateFeedRequest({ + }), + { + }, ]) def test_update_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -2910,7 +2924,7 @@ def test_update_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2963,8 +2977,9 @@ def test_update_feed_non_empty_request_with_auto_populated_field(): client.update_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.UpdateFeedRequest( + request_msg = asset_service.UpdateFeedRequest( ) + assert args[0] == request_msg def test_update_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3033,7 +3048,11 @@ async def test_update_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.UpdateFeedRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.UpdateFeedRequest({ }), + { }, +]) +async def test_update_feed_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3041,7 +3060,7 @@ async def test_update_feed_async(transport: str = 'grpc_asyncio', request_type=a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3071,11 +3090,6 @@ async def test_update_feed_async(transport: str = 'grpc_asyncio', request_type=a assert response.content_type == asset_service.ContentType.RESOURCE assert response.relationship_types == ['relationship_types_value'] - -@pytest.mark.asyncio -async def test_update_feed_async_from_dict(): - await test_update_feed_async(request_type=dict) - def test_update_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3222,8 +3236,10 @@ async def test_update_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.DeleteFeedRequest, - dict, + asset_service.DeleteFeedRequest({ + }), + { + }, ]) def test_delete_feed(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -3233,7 +3249,7 @@ def test_delete_feed(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3276,9 +3292,10 @@ def test_delete_feed_non_empty_request_with_auto_populated_field(): client.delete_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.DeleteFeedRequest( + request_msg = asset_service.DeleteFeedRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_feed_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3347,7 +3364,11 @@ async def test_delete_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.DeleteFeedRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.DeleteFeedRequest({ }), + { }, +]) +async def test_delete_feed_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3355,7 +3376,7 @@ async def test_delete_feed_async(transport: str = 'grpc_asyncio', request_type=a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3374,11 +3395,6 @@ async def test_delete_feed_async(transport: str = 'grpc_asyncio', request_type=a # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_feed_async_from_dict(): - await test_delete_feed_async(request_type=dict) - def test_delete_feed_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3541,10 @@ async def test_delete_feed_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.SearchAllResourcesRequest, - dict, + asset_service.SearchAllResourcesRequest({ + }), + { + }, ]) def test_search_all_resources(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -3536,7 +3554,7 @@ def test_search_all_resources(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3585,12 +3603,13 @@ def test_search_all_resources_non_empty_request_with_auto_populated_field(): client.search_all_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.SearchAllResourcesRequest( + request_msg = asset_service.SearchAllResourcesRequest( scope='scope_value', query='query_value', page_token='page_token_value', order_by='order_by_value', ) + assert args[0] == request_msg def test_search_all_resources_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3659,7 +3678,11 @@ async def test_search_all_resources_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_search_all_resources_async(transport: str = 'grpc_asyncio', request_type=asset_service.SearchAllResourcesRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.SearchAllResourcesRequest({ }), + { }, +]) +async def test_search_all_resources_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3667,7 +3690,7 @@ async def test_search_all_resources_async(transport: str = 'grpc_asyncio', reque # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3689,11 +3712,6 @@ async def test_search_all_resources_async(transport: str = 'grpc_asyncio', reque assert isinstance(response, pagers.SearchAllResourcesAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_search_all_resources_async_from_dict(): - await test_search_all_resources_async(request_type=dict) - def test_search_all_resources_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4054,8 +4072,10 @@ async def test_search_all_resources_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.SearchAllIamPoliciesRequest, - dict, + asset_service.SearchAllIamPoliciesRequest({ + }), + { + }, ]) def test_search_all_iam_policies(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -4065,7 +4085,7 @@ def test_search_all_iam_policies(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4114,12 +4134,13 @@ def test_search_all_iam_policies_non_empty_request_with_auto_populated_field(): client.search_all_iam_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.SearchAllIamPoliciesRequest( + request_msg = asset_service.SearchAllIamPoliciesRequest( scope='scope_value', query='query_value', page_token='page_token_value', order_by='order_by_value', ) + assert args[0] == request_msg def test_search_all_iam_policies_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4188,7 +4209,11 @@ async def test_search_all_iam_policies_async_use_cached_wrapped_rpc(transport: s assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_search_all_iam_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.SearchAllIamPoliciesRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.SearchAllIamPoliciesRequest({ }), + { }, +]) +async def test_search_all_iam_policies_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4196,7 +4221,7 @@ async def test_search_all_iam_policies_async(transport: str = 'grpc_asyncio', re # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4218,11 +4243,6 @@ async def test_search_all_iam_policies_async(transport: str = 'grpc_asyncio', re assert isinstance(response, pagers.SearchAllIamPoliciesAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_search_all_iam_policies_async_from_dict(): - await test_search_all_iam_policies_async(request_type=dict) - def test_search_all_iam_policies_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4573,8 +4593,10 @@ async def test_search_all_iam_policies_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeIamPolicyRequest, - dict, + asset_service.AnalyzeIamPolicyRequest({ + }), + { + }, ]) def test_analyze_iam_policy(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -4584,7 +4606,7 @@ def test_analyze_iam_policy(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4630,9 +4652,10 @@ def test_analyze_iam_policy_non_empty_request_with_auto_populated_field(): client.analyze_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeIamPolicyRequest( + request_msg = asset_service.AnalyzeIamPolicyRequest( saved_analysis_query='saved_analysis_query_value', ) + assert args[0] == request_msg def test_analyze_iam_policy_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4701,7 +4724,11 @@ async def test_analyze_iam_policy_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_analyze_iam_policy_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeIamPolicyRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.AnalyzeIamPolicyRequest({ }), + { }, +]) +async def test_analyze_iam_policy_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4709,7 +4736,7 @@ async def test_analyze_iam_policy_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4731,11 +4758,6 @@ async def test_analyze_iam_policy_async(transport: str = 'grpc_asyncio', request assert isinstance(response, asset_service.AnalyzeIamPolicyResponse) assert response.fully_explored is True - -@pytest.mark.asyncio -async def test_analyze_iam_policy_async_from_dict(): - await test_analyze_iam_policy_async(request_type=dict) - def test_analyze_iam_policy_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4800,8 +4822,10 @@ async def test_analyze_iam_policy_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeIamPolicyLongrunningRequest, - dict, + asset_service.AnalyzeIamPolicyLongrunningRequest({ + }), + { + }, ]) def test_analyze_iam_policy_longrunning(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -4811,7 +4835,7 @@ def test_analyze_iam_policy_longrunning(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4854,9 +4878,10 @@ def test_analyze_iam_policy_longrunning_non_empty_request_with_auto_populated_fi client.analyze_iam_policy_longrunning(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest( + request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest( saved_analysis_query='saved_analysis_query_value', ) + assert args[0] == request_msg def test_analyze_iam_policy_longrunning_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4935,7 +4960,11 @@ async def test_analyze_iam_policy_longrunning_async_use_cached_wrapped_rpc(trans assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_analyze_iam_policy_longrunning_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeIamPolicyLongrunningRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.AnalyzeIamPolicyLongrunningRequest({ }), + { }, +]) +async def test_analyze_iam_policy_longrunning_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4943,7 +4972,7 @@ async def test_analyze_iam_policy_longrunning_async(transport: str = 'grpc_async # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4964,11 +4993,6 @@ async def test_analyze_iam_policy_longrunning_async(transport: str = 'grpc_async # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_analyze_iam_policy_longrunning_async_from_dict(): - await test_analyze_iam_policy_longrunning_async(request_type=dict) - def test_analyze_iam_policy_longrunning_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5033,8 +5057,10 @@ async def test_analyze_iam_policy_longrunning_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeMoveRequest, - dict, + asset_service.AnalyzeMoveRequest({ + }), + { + }, ]) def test_analyze_move(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5044,7 +5070,7 @@ def test_analyze_move(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5089,10 +5115,11 @@ def test_analyze_move_non_empty_request_with_auto_populated_field(): client.analyze_move(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeMoveRequest( + request_msg = asset_service.AnalyzeMoveRequest( resource='resource_value', destination_parent='destination_parent_value', ) + assert args[0] == request_msg def test_analyze_move_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5161,7 +5188,11 @@ async def test_analyze_move_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_analyze_move_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeMoveRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.AnalyzeMoveRequest({ }), + { }, +]) +async def test_analyze_move_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5169,7 +5200,7 @@ async def test_analyze_move_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5189,11 +5220,6 @@ async def test_analyze_move_async(transport: str = 'grpc_asyncio', request_type= # Establish that the response is the type that we expect. assert isinstance(response, asset_service.AnalyzeMoveResponse) - -@pytest.mark.asyncio -async def test_analyze_move_async_from_dict(): - await test_analyze_move_async(request_type=dict) - def test_analyze_move_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5258,8 +5284,10 @@ async def test_analyze_move_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.QueryAssetsRequest, - dict, + asset_service.QueryAssetsRequest({ + }), + { + }, ]) def test_query_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5269,7 +5297,7 @@ def test_query_assets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5320,12 +5348,13 @@ def test_query_assets_non_empty_request_with_auto_populated_field(): client.query_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.QueryAssetsRequest( + request_msg = asset_service.QueryAssetsRequest( parent='parent_value', statement='statement_value', job_reference='job_reference_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_query_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5394,7 +5423,11 @@ async def test_query_assets_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_query_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.QueryAssetsRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.QueryAssetsRequest({ }), + { }, +]) +async def test_query_assets_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5402,7 +5435,7 @@ async def test_query_assets_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5426,11 +5459,6 @@ async def test_query_assets_async(transport: str = 'grpc_asyncio', request_type= assert response.job_reference == 'job_reference_value' assert response.done is True - -@pytest.mark.asyncio -async def test_query_assets_async_from_dict(): - await test_query_assets_async(request_type=dict) - def test_query_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5495,8 +5523,10 @@ async def test_query_assets_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.CreateSavedQueryRequest, - dict, + asset_service.CreateSavedQueryRequest({ + }), + { + }, ]) def test_create_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5506,7 +5536,7 @@ def test_create_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5559,10 +5589,11 @@ def test_create_saved_query_non_empty_request_with_auto_populated_field(): client.create_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.CreateSavedQueryRequest( + request_msg = asset_service.CreateSavedQueryRequest( parent='parent_value', saved_query_id='saved_query_id_value', ) + assert args[0] == request_msg def test_create_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5631,7 +5662,11 @@ async def test_create_saved_query_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.CreateSavedQueryRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.CreateSavedQueryRequest({ }), + { }, +]) +async def test_create_saved_query_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5639,7 +5674,7 @@ async def test_create_saved_query_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5667,11 +5702,6 @@ async def test_create_saved_query_async(transport: str = 'grpc_asyncio', request assert response.creator == 'creator_value' assert response.last_updater == 'last_updater_value' - -@pytest.mark.asyncio -async def test_create_saved_query_async_from_dict(): - await test_create_saved_query_async(request_type=dict) - def test_create_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5838,8 +5868,10 @@ async def test_create_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.GetSavedQueryRequest, - dict, + asset_service.GetSavedQueryRequest({ + }), + { + }, ]) def test_get_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -5849,7 +5881,7 @@ def test_get_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5901,9 +5933,10 @@ def test_get_saved_query_non_empty_request_with_auto_populated_field(): client.get_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.GetSavedQueryRequest( + request_msg = asset_service.GetSavedQueryRequest( name='name_value', ) + assert args[0] == request_msg def test_get_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5972,7 +6005,11 @@ async def test_get_saved_query_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.GetSavedQueryRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.GetSavedQueryRequest({ }), + { }, +]) +async def test_get_saved_query_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5980,7 +6017,7 @@ async def test_get_saved_query_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6008,11 +6045,6 @@ async def test_get_saved_query_async(transport: str = 'grpc_asyncio', request_ty assert response.creator == 'creator_value' assert response.last_updater == 'last_updater_value' - -@pytest.mark.asyncio -async def test_get_saved_query_async_from_dict(): - await test_get_saved_query_async(request_type=dict) - def test_get_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6159,8 +6191,10 @@ async def test_get_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.ListSavedQueriesRequest, - dict, + asset_service.ListSavedQueriesRequest({ + }), + { + }, ]) def test_list_saved_queries(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -6170,7 +6204,7 @@ def test_list_saved_queries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6218,11 +6252,12 @@ def test_list_saved_queries_non_empty_request_with_auto_populated_field(): client.list_saved_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListSavedQueriesRequest( + request_msg = asset_service.ListSavedQueriesRequest( parent='parent_value', filter='filter_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_saved_queries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6291,7 +6326,11 @@ async def test_list_saved_queries_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_saved_queries_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListSavedQueriesRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.ListSavedQueriesRequest({ }), + { }, +]) +async def test_list_saved_queries_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6299,7 +6338,7 @@ async def test_list_saved_queries_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6321,11 +6360,6 @@ async def test_list_saved_queries_async(transport: str = 'grpc_asyncio', request assert isinstance(response, pagers.ListSavedQueriesAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_saved_queries_async_from_dict(): - await test_list_saved_queries_async(request_type=dict) - def test_list_saved_queries_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6666,8 +6700,10 @@ async def test_list_saved_queries_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.UpdateSavedQueryRequest, - dict, + asset_service.UpdateSavedQueryRequest({ + }), + { + }, ]) def test_update_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -6677,7 +6713,7 @@ def test_update_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6728,8 +6764,9 @@ def test_update_saved_query_non_empty_request_with_auto_populated_field(): client.update_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.UpdateSavedQueryRequest( + request_msg = asset_service.UpdateSavedQueryRequest( ) + assert args[0] == request_msg def test_update_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6798,7 +6835,11 @@ async def test_update_saved_query_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.UpdateSavedQueryRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.UpdateSavedQueryRequest({ }), + { }, +]) +async def test_update_saved_query_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6806,7 +6847,7 @@ async def test_update_saved_query_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6834,11 +6875,6 @@ async def test_update_saved_query_async(transport: str = 'grpc_asyncio', request assert response.creator == 'creator_value' assert response.last_updater == 'last_updater_value' - -@pytest.mark.asyncio -async def test_update_saved_query_async_from_dict(): - await test_update_saved_query_async(request_type=dict) - def test_update_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6995,8 +7031,10 @@ async def test_update_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.DeleteSavedQueryRequest, - dict, + asset_service.DeleteSavedQueryRequest({ + }), + { + }, ]) def test_delete_saved_query(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -7006,7 +7044,7 @@ def test_delete_saved_query(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7049,9 +7087,10 @@ def test_delete_saved_query_non_empty_request_with_auto_populated_field(): client.delete_saved_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.DeleteSavedQueryRequest( + request_msg = asset_service.DeleteSavedQueryRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_saved_query_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7120,7 +7159,11 @@ async def test_delete_saved_query_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.DeleteSavedQueryRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.DeleteSavedQueryRequest({ }), + { }, +]) +async def test_delete_saved_query_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7128,7 +7171,7 @@ async def test_delete_saved_query_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7147,11 +7190,6 @@ async def test_delete_saved_query_async(transport: str = 'grpc_asyncio', request # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_saved_query_async_from_dict(): - await test_delete_saved_query_async(request_type=dict) - def test_delete_saved_query_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7298,8 +7336,10 @@ async def test_delete_saved_query_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - asset_service.BatchGetEffectiveIamPoliciesRequest, - dict, + asset_service.BatchGetEffectiveIamPoliciesRequest({ + }), + { + }, ]) def test_batch_get_effective_iam_policies(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -7309,7 +7349,7 @@ def test_batch_get_effective_iam_policies(request_type, transport: str = 'grpc') # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7353,9 +7393,10 @@ def test_batch_get_effective_iam_policies_non_empty_request_with_auto_populated_ client.batch_get_effective_iam_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest( + request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest( scope='scope_value', ) + assert args[0] == request_msg def test_batch_get_effective_iam_policies_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7424,7 +7465,11 @@ async def test_batch_get_effective_iam_policies_async_use_cached_wrapped_rpc(tra assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_batch_get_effective_iam_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.BatchGetEffectiveIamPoliciesRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.BatchGetEffectiveIamPoliciesRequest({ }), + { }, +]) +async def test_batch_get_effective_iam_policies_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7432,7 +7477,7 @@ async def test_batch_get_effective_iam_policies_async(transport: str = 'grpc_asy # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7452,11 +7497,6 @@ async def test_batch_get_effective_iam_policies_async(transport: str = 'grpc_asy # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetEffectiveIamPoliciesResponse) - -@pytest.mark.asyncio -async def test_batch_get_effective_iam_policies_async_from_dict(): - await test_batch_get_effective_iam_policies_async(request_type=dict) - def test_batch_get_effective_iam_policies_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7521,8 +7561,10 @@ async def test_batch_get_effective_iam_policies_field_headers_async(): @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPoliciesRequest, - dict, + asset_service.AnalyzeOrgPoliciesRequest({ + }), + { + }, ]) def test_analyze_org_policies(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -7532,7 +7574,7 @@ def test_analyze_org_policies(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7581,12 +7623,13 @@ def test_analyze_org_policies_non_empty_request_with_auto_populated_field(): client.analyze_org_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPoliciesRequest( + request_msg = asset_service.AnalyzeOrgPoliciesRequest( scope='scope_value', constraint='constraint_value', filter='filter_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_analyze_org_policies_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7655,7 +7698,11 @@ async def test_analyze_org_policies_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_analyze_org_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPoliciesRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.AnalyzeOrgPoliciesRequest({ }), + { }, +]) +async def test_analyze_org_policies_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7663,7 +7710,7 @@ async def test_analyze_org_policies_async(transport: str = 'grpc_asyncio', reque # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7685,11 +7732,6 @@ async def test_analyze_org_policies_async(transport: str = 'grpc_asyncio', reque assert isinstance(response, pagers.AnalyzeOrgPoliciesAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_analyze_org_policies_async_from_dict(): - await test_analyze_org_policies_async(request_type=dict) - def test_analyze_org_policies_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8050,8 +8092,10 @@ async def test_analyze_org_policies_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPolicyGovernedContainersRequest, - dict, + asset_service.AnalyzeOrgPolicyGovernedContainersRequest({ + }), + { + }, ]) def test_analyze_org_policy_governed_containers(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -8061,7 +8105,7 @@ def test_analyze_org_policy_governed_containers(request_type, transport: str = ' # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8110,12 +8154,13 @@ def test_analyze_org_policy_governed_containers_non_empty_request_with_auto_popu client.analyze_org_policy_governed_containers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest( + request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest( scope='scope_value', constraint='constraint_value', filter='filter_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_analyze_org_policy_governed_containers_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8184,7 +8229,11 @@ async def test_analyze_org_policy_governed_containers_async_use_cached_wrapped_r assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_analyze_org_policy_governed_containers_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPolicyGovernedContainersRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.AnalyzeOrgPolicyGovernedContainersRequest({ }), + { }, +]) +async def test_analyze_org_policy_governed_containers_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8192,7 +8241,7 @@ async def test_analyze_org_policy_governed_containers_async(transport: str = 'gr # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8214,11 +8263,6 @@ async def test_analyze_org_policy_governed_containers_async(transport: str = 'gr assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedContainersAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_analyze_org_policy_governed_containers_async_from_dict(): - await test_analyze_org_policy_governed_containers_async(request_type=dict) - def test_analyze_org_policy_governed_containers_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8579,8 +8623,10 @@ async def test_analyze_org_policy_governed_containers_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - asset_service.AnalyzeOrgPolicyGovernedAssetsRequest, - dict, + asset_service.AnalyzeOrgPolicyGovernedAssetsRequest({ + }), + { + }, ]) def test_analyze_org_policy_governed_assets(request_type, transport: str = 'grpc'): client = AssetServiceClient( @@ -8590,7 +8636,7 @@ def test_analyze_org_policy_governed_assets(request_type, transport: str = 'grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8639,12 +8685,13 @@ def test_analyze_org_policy_governed_assets_non_empty_request_with_auto_populate client.analyze_org_policy_governed_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( + request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( scope='scope_value', constraint='constraint_value', filter='filter_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_analyze_org_policy_governed_assets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8713,7 +8760,11 @@ async def test_analyze_org_policy_governed_assets_async_use_cached_wrapped_rpc(t assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_analyze_org_policy_governed_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPolicyGovernedAssetsRequest): +@pytest.mark.parametrize("request_type", [ + asset_service.AnalyzeOrgPolicyGovernedAssetsRequest({ }), + { }, +]) +async def test_analyze_org_policy_governed_assets_async(request_type, transport: str = 'grpc_asyncio'): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8721,7 +8772,7 @@ async def test_analyze_org_policy_governed_assets_async(transport: str = 'grpc_a # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8743,11 +8794,6 @@ async def test_analyze_org_policy_governed_assets_async(transport: str = 'grpc_a assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedAssetsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_analyze_org_policy_governed_assets_async_from_dict(): - await test_analyze_org_policy_governed_assets_async(request_type=dict) - def test_analyze_org_policy_governed_assets_field_headers(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13202,7 +13248,6 @@ def test_export_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() - assert args[0] == request_msg @@ -13225,7 +13270,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() - assert args[0] == request_msg @@ -13248,7 +13292,6 @@ def test_batch_get_assets_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() - assert args[0] == request_msg @@ -13271,7 +13314,6 @@ def test_create_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() - assert args[0] == request_msg @@ -13294,7 +13336,6 @@ def test_get_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() - assert args[0] == request_msg @@ -13317,7 +13358,6 @@ def test_list_feeds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() - assert args[0] == request_msg @@ -13340,7 +13380,6 @@ def test_update_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() - assert args[0] == request_msg @@ -13363,7 +13402,6 @@ def test_delete_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() - assert args[0] == request_msg @@ -13386,7 +13424,6 @@ def test_search_all_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() - assert args[0] == request_msg @@ -13409,7 +13446,6 @@ def test_search_all_iam_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() - assert args[0] == request_msg @@ -13432,7 +13468,6 @@ def test_analyze_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() - assert args[0] == request_msg @@ -13455,7 +13490,6 @@ def test_analyze_iam_policy_longrunning_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() - assert args[0] == request_msg @@ -13478,7 +13512,6 @@ def test_analyze_move_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() - assert args[0] == request_msg @@ -13501,7 +13534,6 @@ def test_query_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() - assert args[0] == request_msg @@ -13524,7 +13556,6 @@ def test_create_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() - assert args[0] == request_msg @@ -13547,7 +13578,6 @@ def test_get_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() - assert args[0] == request_msg @@ -13570,7 +13600,6 @@ def test_list_saved_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() - assert args[0] == request_msg @@ -13593,7 +13622,6 @@ def test_update_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() - assert args[0] == request_msg @@ -13616,7 +13644,6 @@ def test_delete_saved_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() - assert args[0] == request_msg @@ -13639,7 +13666,6 @@ def test_batch_get_effective_iam_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() - assert args[0] == request_msg @@ -13662,7 +13688,6 @@ def test_analyze_org_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() - assert args[0] == request_msg @@ -13685,7 +13710,6 @@ def test_analyze_org_policy_governed_containers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() - assert args[0] == request_msg @@ -13708,7 +13732,6 @@ def test_analyze_org_policy_governed_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() - assert args[0] == request_msg @@ -13750,7 +13773,6 @@ async def test_export_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() - assert args[0] == request_msg @@ -13777,7 +13799,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() - assert args[0] == request_msg @@ -13803,7 +13824,6 @@ async def test_batch_get_assets_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() - assert args[0] == request_msg @@ -13834,7 +13854,6 @@ async def test_create_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() - assert args[0] == request_msg @@ -13865,7 +13884,6 @@ async def test_get_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() - assert args[0] == request_msg @@ -13891,7 +13909,6 @@ async def test_list_feeds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() - assert args[0] == request_msg @@ -13922,7 +13939,6 @@ async def test_update_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() - assert args[0] == request_msg @@ -13947,7 +13963,6 @@ async def test_delete_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() - assert args[0] == request_msg @@ -13974,7 +13989,6 @@ async def test_search_all_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() - assert args[0] == request_msg @@ -14001,7 +14015,6 @@ async def test_search_all_iam_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() - assert args[0] == request_msg @@ -14028,7 +14041,6 @@ async def test_analyze_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() - assert args[0] == request_msg @@ -14055,7 +14067,6 @@ async def test_analyze_iam_policy_longrunning_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() - assert args[0] == request_msg @@ -14081,7 +14092,6 @@ async def test_analyze_move_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() - assert args[0] == request_msg @@ -14109,7 +14119,6 @@ async def test_query_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() - assert args[0] == request_msg @@ -14139,7 +14148,6 @@ async def test_create_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() - assert args[0] == request_msg @@ -14169,7 +14177,6 @@ async def test_get_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() - assert args[0] == request_msg @@ -14196,7 +14203,6 @@ async def test_list_saved_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() - assert args[0] == request_msg @@ -14226,7 +14232,6 @@ async def test_update_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() - assert args[0] == request_msg @@ -14251,7 +14256,6 @@ async def test_delete_saved_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() - assert args[0] == request_msg @@ -14277,7 +14281,6 @@ async def test_batch_get_effective_iam_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() - assert args[0] == request_msg @@ -14304,7 +14307,6 @@ async def test_analyze_org_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() - assert args[0] == request_msg @@ -14331,7 +14333,6 @@ async def test_analyze_org_policy_governed_containers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() - assert args[0] == request_msg @@ -14358,7 +14359,6 @@ async def test_analyze_org_policy_governed_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() - assert args[0] == request_msg @@ -17007,7 +17007,6 @@ def test_export_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() - assert args[0] == request_msg @@ -17029,7 +17028,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() - assert args[0] == request_msg @@ -17051,7 +17049,6 @@ def test_batch_get_assets_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() - assert args[0] == request_msg @@ -17073,7 +17070,6 @@ def test_create_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() - assert args[0] == request_msg @@ -17095,7 +17091,6 @@ def test_get_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() - assert args[0] == request_msg @@ -17117,7 +17112,6 @@ def test_list_feeds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() - assert args[0] == request_msg @@ -17139,7 +17133,6 @@ def test_update_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() - assert args[0] == request_msg @@ -17161,7 +17154,6 @@ def test_delete_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() - assert args[0] == request_msg @@ -17183,7 +17175,6 @@ def test_search_all_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() - assert args[0] == request_msg @@ -17205,7 +17196,6 @@ def test_search_all_iam_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() - assert args[0] == request_msg @@ -17227,7 +17217,6 @@ def test_analyze_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() - assert args[0] == request_msg @@ -17249,7 +17238,6 @@ def test_analyze_iam_policy_longrunning_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() - assert args[0] == request_msg @@ -17271,7 +17259,6 @@ def test_analyze_move_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() - assert args[0] == request_msg @@ -17293,7 +17280,6 @@ def test_query_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() - assert args[0] == request_msg @@ -17315,7 +17301,6 @@ def test_create_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() - assert args[0] == request_msg @@ -17337,7 +17322,6 @@ def test_get_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() - assert args[0] == request_msg @@ -17359,7 +17343,6 @@ def test_list_saved_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() - assert args[0] == request_msg @@ -17381,7 +17364,6 @@ def test_update_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() - assert args[0] == request_msg @@ -17403,7 +17385,6 @@ def test_delete_saved_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() - assert args[0] == request_msg @@ -17425,7 +17406,6 @@ def test_batch_get_effective_iam_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() - assert args[0] == request_msg @@ -17447,7 +17427,6 @@ def test_analyze_org_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() - assert args[0] == request_msg @@ -17469,7 +17448,6 @@ def test_analyze_org_policy_governed_containers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() - assert args[0] == request_msg @@ -17491,7 +17469,6 @@ def test_analyze_org_policy_governed_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py index 135ef862723b..6cf5dca6bfb0 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py @@ -971,8 +971,10 @@ def test_iam_credentials_client_create_channel_credentials_file(client_class, tr @pytest.mark.parametrize("request_type", [ - common.GenerateAccessTokenRequest, - dict, + common.GenerateAccessTokenRequest({ + }), + { + }, ]) def test_generate_access_token(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -982,7 +984,7 @@ def test_generate_access_token(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1028,9 +1030,10 @@ def test_generate_access_token_non_empty_request_with_auto_populated_field(): client.generate_access_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == common.GenerateAccessTokenRequest( + request_msg = common.GenerateAccessTokenRequest( name='name_value', ) + assert args[0] == request_msg def test_generate_access_token_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1099,7 +1102,11 @@ async def test_generate_access_token_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_generate_access_token_async(transport: str = 'grpc_asyncio', request_type=common.GenerateAccessTokenRequest): +@pytest.mark.parametrize("request_type", [ + common.GenerateAccessTokenRequest({ }), + { }, +]) +async def test_generate_access_token_async(request_type, transport: str = 'grpc_asyncio'): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1107,7 +1114,7 @@ async def test_generate_access_token_async(transport: str = 'grpc_asyncio', requ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1129,11 +1136,6 @@ async def test_generate_access_token_async(transport: str = 'grpc_asyncio', requ assert isinstance(response, common.GenerateAccessTokenResponse) assert response.access_token == 'access_token_value' - -@pytest.mark.asyncio -async def test_generate_access_token_async_from_dict(): - await test_generate_access_token_async(request_type=dict) - def test_generate_access_token_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1306,8 +1308,10 @@ async def test_generate_access_token_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - common.GenerateIdTokenRequest, - dict, + common.GenerateIdTokenRequest({ + }), + { + }, ]) def test_generate_id_token(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -1317,7 +1321,7 @@ def test_generate_id_token(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1364,10 +1368,11 @@ def test_generate_id_token_non_empty_request_with_auto_populated_field(): client.generate_id_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == common.GenerateIdTokenRequest( + request_msg = common.GenerateIdTokenRequest( name='name_value', audience='audience_value', ) + assert args[0] == request_msg def test_generate_id_token_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1436,7 +1441,11 @@ async def test_generate_id_token_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_generate_id_token_async(transport: str = 'grpc_asyncio', request_type=common.GenerateIdTokenRequest): +@pytest.mark.parametrize("request_type", [ + common.GenerateIdTokenRequest({ }), + { }, +]) +async def test_generate_id_token_async(request_type, transport: str = 'grpc_asyncio'): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1444,7 +1453,7 @@ async def test_generate_id_token_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1466,11 +1475,6 @@ async def test_generate_id_token_async(transport: str = 'grpc_asyncio', request_ assert isinstance(response, common.GenerateIdTokenResponse) assert response.token == 'token_value' - -@pytest.mark.asyncio -async def test_generate_id_token_async_from_dict(): - await test_generate_id_token_async(request_type=dict) - def test_generate_id_token_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1647,8 +1651,10 @@ async def test_generate_id_token_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - common.SignBlobRequest, - dict, + common.SignBlobRequest({ + }), + { + }, ]) def test_sign_blob(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -1658,7 +1664,7 @@ def test_sign_blob(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1706,9 +1712,10 @@ def test_sign_blob_non_empty_request_with_auto_populated_field(): client.sign_blob(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == common.SignBlobRequest( + request_msg = common.SignBlobRequest( name='name_value', ) + assert args[0] == request_msg def test_sign_blob_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1777,7 +1784,11 @@ async def test_sign_blob_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=common.SignBlobRequest): +@pytest.mark.parametrize("request_type", [ + common.SignBlobRequest({ }), + { }, +]) +async def test_sign_blob_async(request_type, transport: str = 'grpc_asyncio'): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1785,7 +1796,7 @@ async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=com # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1809,11 +1820,6 @@ async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=com assert response.key_id == 'key_id_value' assert response.signed_blob == b'signed_blob_blob' - -@pytest.mark.asyncio -async def test_sign_blob_async_from_dict(): - await test_sign_blob_async(request_type=dict) - def test_sign_blob_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1980,8 +1986,10 @@ async def test_sign_blob_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - common.SignJwtRequest, - dict, + common.SignJwtRequest({ + }), + { + }, ]) def test_sign_jwt(request_type, transport: str = 'grpc'): client = IAMCredentialsClient( @@ -1991,7 +1999,7 @@ def test_sign_jwt(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2040,10 +2048,11 @@ def test_sign_jwt_non_empty_request_with_auto_populated_field(): client.sign_jwt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == common.SignJwtRequest( + request_msg = common.SignJwtRequest( name='name_value', payload='payload_value', ) + assert args[0] == request_msg def test_sign_jwt_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2112,7 +2121,11 @@ async def test_sign_jwt_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_sign_jwt_async(transport: str = 'grpc_asyncio', request_type=common.SignJwtRequest): +@pytest.mark.parametrize("request_type", [ + common.SignJwtRequest({ }), + { }, +]) +async def test_sign_jwt_async(request_type, transport: str = 'grpc_asyncio'): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2120,7 +2133,7 @@ async def test_sign_jwt_async(transport: str = 'grpc_asyncio', request_type=comm # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2144,11 +2157,6 @@ async def test_sign_jwt_async(transport: str = 'grpc_asyncio', request_type=comm assert response.key_id == 'key_id_value' assert response.signed_jwt == 'signed_jwt_value' - -@pytest.mark.asyncio -async def test_sign_jwt_async_from_dict(): - await test_sign_jwt_async(request_type=dict) - def test_sign_jwt_field_headers(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3139,7 +3147,6 @@ def test_generate_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -3162,7 +3169,6 @@ def test_generate_id_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() - assert args[0] == request_msg @@ -3185,7 +3191,6 @@ def test_sign_blob_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() - assert args[0] == request_msg @@ -3208,7 +3213,6 @@ def test_sign_jwt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() - assert args[0] == request_msg @@ -3250,7 +3254,6 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -3277,7 +3280,6 @@ async def test_generate_id_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() - assert args[0] == request_msg @@ -3305,7 +3307,6 @@ async def test_sign_blob_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() - assert args[0] == request_msg @@ -3333,7 +3334,6 @@ async def test_sign_jwt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() - assert args[0] == request_msg @@ -3797,7 +3797,6 @@ def test_generate_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -3819,7 +3818,6 @@ def test_generate_id_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() - assert args[0] == request_msg @@ -3841,7 +3839,6 @@ def test_sign_blob_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() - assert args[0] == request_msg @@ -3863,7 +3860,6 @@ def test_sign_jwt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index 060114488e07..c39b30af0310 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py @@ -1002,8 +1002,10 @@ def test_eventarc_client_create_channel_credentials_file(client_class, transport @pytest.mark.parametrize("request_type", [ - eventarc.GetTriggerRequest, - dict, + eventarc.GetTriggerRequest({ + }), + { + }, ]) def test_get_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -1013,7 +1015,7 @@ def test_get_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1071,9 +1073,10 @@ def test_get_trigger_non_empty_request_with_auto_populated_field(): client.get_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetTriggerRequest( + request_msg = eventarc.GetTriggerRequest( name='name_value', ) + assert args[0] == request_msg def test_get_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1142,7 +1145,11 @@ async def test_get_trigger_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetTriggerRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetTriggerRequest({ }), + { }, +]) +async def test_get_trigger_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1150,7 +1157,7 @@ async def test_get_trigger_async(transport: str = 'grpc_asyncio', request_type=e # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1184,11 +1191,6 @@ async def test_get_trigger_async(transport: str = 'grpc_asyncio', request_type=e assert response.satisfies_pzs is True assert response.etag == 'etag_value' - -@pytest.mark.asyncio -async def test_get_trigger_async_from_dict(): - await test_get_trigger_async(request_type=dict) - def test_get_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1335,8 +1337,10 @@ async def test_get_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListTriggersRequest, - dict, + eventarc.ListTriggersRequest({ + }), + { + }, ]) def test_list_triggers(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -1346,7 +1350,7 @@ def test_list_triggers(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1397,12 +1401,13 @@ def test_list_triggers_non_empty_request_with_auto_populated_field(): client.list_triggers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListTriggersRequest( + request_msg = eventarc.ListTriggersRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) + assert args[0] == request_msg def test_list_triggers_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1471,7 +1476,11 @@ async def test_list_triggers_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_triggers_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListTriggersRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListTriggersRequest({ }), + { }, +]) +async def test_list_triggers_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1479,7 +1488,7 @@ async def test_list_triggers_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1503,11 +1512,6 @@ async def test_list_triggers_async(transport: str = 'grpc_asyncio', request_type assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_triggers_async_from_dict(): - await test_list_triggers_async(request_type=dict) - def test_list_triggers_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1848,8 +1852,10 @@ async def test_list_triggers_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateTriggerRequest, - dict, + eventarc.CreateTriggerRequest({ + }), + { + }, ]) def test_create_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -1859,7 +1865,7 @@ def test_create_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1903,10 +1909,11 @@ def test_create_trigger_non_empty_request_with_auto_populated_field(): client.create_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateTriggerRequest( + request_msg = eventarc.CreateTriggerRequest( parent='parent_value', trigger_id='trigger_id_value', ) + assert args[0] == request_msg def test_create_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1985,7 +1992,11 @@ async def test_create_trigger_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateTriggerRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreateTriggerRequest({ }), + { }, +]) +async def test_create_trigger_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1993,7 +2004,7 @@ async def test_create_trigger_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2014,11 +2025,6 @@ async def test_create_trigger_async(transport: str = 'grpc_asyncio', request_typ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_trigger_async_from_dict(): - await test_create_trigger_async(request_type=dict) - def test_create_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2187,8 +2193,10 @@ async def test_create_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateTriggerRequest, - dict, + eventarc.UpdateTriggerRequest({ + }), + { + }, ]) def test_update_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -2198,7 +2206,7 @@ def test_update_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2240,8 +2248,9 @@ def test_update_trigger_non_empty_request_with_auto_populated_field(): client.update_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateTriggerRequest( + request_msg = eventarc.UpdateTriggerRequest( ) + assert args[0] == request_msg def test_update_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2320,7 +2329,11 @@ async def test_update_trigger_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateTriggerRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdateTriggerRequest({ }), + { }, +]) +async def test_update_trigger_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2328,7 +2341,7 @@ async def test_update_trigger_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2349,11 +2362,6 @@ async def test_update_trigger_async(transport: str = 'grpc_asyncio', request_typ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_trigger_async_from_dict(): - await test_update_trigger_async(request_type=dict) - def test_update_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2522,8 +2530,10 @@ async def test_update_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteTriggerRequest, - dict, + eventarc.DeleteTriggerRequest({ + }), + { + }, ]) def test_delete_trigger(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -2533,7 +2543,7 @@ def test_delete_trigger(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2577,10 +2587,11 @@ def test_delete_trigger_non_empty_request_with_auto_populated_field(): client.delete_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteTriggerRequest( + request_msg = eventarc.DeleteTriggerRequest( name='name_value', etag='etag_value', ) + assert args[0] == request_msg def test_delete_trigger_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2659,7 +2670,11 @@ async def test_delete_trigger_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteTriggerRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeleteTriggerRequest({ }), + { }, +]) +async def test_delete_trigger_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2667,7 +2682,7 @@ async def test_delete_trigger_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2688,11 +2703,6 @@ async def test_delete_trigger_async(transport: str = 'grpc_asyncio', request_typ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_trigger_async_from_dict(): - await test_delete_trigger_async(request_type=dict) - def test_delete_trigger_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2851,8 +2861,10 @@ async def test_delete_trigger_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetChannelRequest, - dict, + eventarc.GetChannelRequest({ + }), + { + }, ]) def test_get_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -2862,7 +2874,7 @@ def test_get_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2921,9 +2933,10 @@ def test_get_channel_non_empty_request_with_auto_populated_field(): client.get_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetChannelRequest( + request_msg = eventarc.GetChannelRequest( name='name_value', ) + assert args[0] == request_msg def test_get_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2992,7 +3005,11 @@ async def test_get_channel_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetChannelRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetChannelRequest({ }), + { }, +]) +async def test_get_channel_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3000,7 +3017,7 @@ async def test_get_channel_async(transport: str = 'grpc_asyncio', request_type=e # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3034,11 +3051,6 @@ async def test_get_channel_async(transport: str = 'grpc_asyncio', request_type=e assert response.crypto_key_name == 'crypto_key_name_value' assert response.satisfies_pzs is True - -@pytest.mark.asyncio -async def test_get_channel_async_from_dict(): - await test_get_channel_async(request_type=dict) - def test_get_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3185,8 +3197,10 @@ async def test_get_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListChannelsRequest, - dict, + eventarc.ListChannelsRequest({ + }), + { + }, ]) def test_list_channels(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -3196,7 +3210,7 @@ def test_list_channels(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3246,11 +3260,12 @@ def test_list_channels_non_empty_request_with_auto_populated_field(): client.list_channels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListChannelsRequest( + request_msg = eventarc.ListChannelsRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', ) + assert args[0] == request_msg def test_list_channels_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3319,7 +3334,11 @@ async def test_list_channels_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_channels_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListChannelsRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListChannelsRequest({ }), + { }, +]) +async def test_list_channels_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3327,7 +3346,7 @@ async def test_list_channels_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3351,11 +3370,6 @@ async def test_list_channels_async(transport: str = 'grpc_asyncio', request_type assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_channels_async_from_dict(): - await test_list_channels_async(request_type=dict) - def test_list_channels_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3696,8 +3710,10 @@ async def test_list_channels_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateChannelRequest, - dict, + eventarc.CreateChannelRequest({ + }), + { + }, ]) def test_create_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -3707,7 +3723,7 @@ def test_create_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3751,10 +3767,11 @@ def test_create_channel_non_empty_request_with_auto_populated_field(): client.create_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateChannelRequest( + request_msg = eventarc.CreateChannelRequest( parent='parent_value', channel_id='channel_id_value', ) + assert args[0] == request_msg def test_create_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3833,7 +3850,11 @@ async def test_create_channel_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateChannelRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreateChannelRequest({ }), + { }, +]) +async def test_create_channel_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3841,7 +3862,7 @@ async def test_create_channel_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3862,11 +3883,6 @@ async def test_create_channel_async(transport: str = 'grpc_asyncio', request_typ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_channel_async_from_dict(): - await test_create_channel_async(request_type=dict) - def test_create_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4035,8 +4051,10 @@ async def test_create_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateChannelRequest, - dict, + eventarc.UpdateChannelRequest({ + }), + { + }, ]) def test_update_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -4046,7 +4064,7 @@ def test_update_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4088,8 +4106,9 @@ def test_update_channel_non_empty_request_with_auto_populated_field(): client.update_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateChannelRequest( + request_msg = eventarc.UpdateChannelRequest( ) + assert args[0] == request_msg def test_update_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4168,7 +4187,11 @@ async def test_update_channel_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateChannelRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdateChannelRequest({ }), + { }, +]) +async def test_update_channel_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4176,7 +4199,7 @@ async def test_update_channel_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4197,11 +4220,6 @@ async def test_update_channel_async(transport: str = 'grpc_asyncio', request_typ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_channel_async_from_dict(): - await test_update_channel_async(request_type=dict) - def test_update_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4360,8 +4378,10 @@ async def test_update_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteChannelRequest, - dict, + eventarc.DeleteChannelRequest({ + }), + { + }, ]) def test_delete_channel(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -4371,7 +4391,7 @@ def test_delete_channel(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4414,9 +4434,10 @@ def test_delete_channel_non_empty_request_with_auto_populated_field(): client.delete_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteChannelRequest( + request_msg = eventarc.DeleteChannelRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_channel_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4495,7 +4516,11 @@ async def test_delete_channel_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteChannelRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeleteChannelRequest({ }), + { }, +]) +async def test_delete_channel_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4503,7 +4528,7 @@ async def test_delete_channel_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4524,11 +4549,6 @@ async def test_delete_channel_async(transport: str = 'grpc_asyncio', request_typ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_channel_async_from_dict(): - await test_delete_channel_async(request_type=dict) - def test_delete_channel_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4677,8 +4697,10 @@ async def test_delete_channel_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetProviderRequest, - dict, + eventarc.GetProviderRequest({ + }), + { + }, ]) def test_get_provider(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -4688,7 +4710,7 @@ def test_get_provider(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4736,9 +4758,10 @@ def test_get_provider_non_empty_request_with_auto_populated_field(): client.get_provider(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetProviderRequest( + request_msg = eventarc.GetProviderRequest( name='name_value', ) + assert args[0] == request_msg def test_get_provider_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4807,7 +4830,11 @@ async def test_get_provider_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_provider_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetProviderRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetProviderRequest({ }), + { }, +]) +async def test_get_provider_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4815,7 +4842,7 @@ async def test_get_provider_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4839,11 +4866,6 @@ async def test_get_provider_async(transport: str = 'grpc_asyncio', request_type= assert response.name == 'name_value' assert response.display_name == 'display_name_value' - -@pytest.mark.asyncio -async def test_get_provider_async_from_dict(): - await test_get_provider_async(request_type=dict) - def test_get_provider_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4990,8 +5012,10 @@ async def test_get_provider_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListProvidersRequest, - dict, + eventarc.ListProvidersRequest({ + }), + { + }, ]) def test_list_providers(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -5001,7 +5025,7 @@ def test_list_providers(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5052,12 +5076,13 @@ def test_list_providers_non_empty_request_with_auto_populated_field(): client.list_providers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListProvidersRequest( + request_msg = eventarc.ListProvidersRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) + assert args[0] == request_msg def test_list_providers_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5126,7 +5151,11 @@ async def test_list_providers_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_providers_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListProvidersRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListProvidersRequest({ }), + { }, +]) +async def test_list_providers_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5134,7 +5163,7 @@ async def test_list_providers_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5158,11 +5187,6 @@ async def test_list_providers_async(transport: str = 'grpc_asyncio', request_typ assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_providers_async_from_dict(): - await test_list_providers_async(request_type=dict) - def test_list_providers_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5503,8 +5527,10 @@ async def test_list_providers_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.GetChannelConnectionRequest, - dict, + eventarc.GetChannelConnectionRequest({ + }), + { + }, ]) def test_get_channel_connection(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -5514,7 +5540,7 @@ def test_get_channel_connection(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5566,9 +5592,10 @@ def test_get_channel_connection_non_empty_request_with_auto_populated_field(): client.get_channel_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetChannelConnectionRequest( + request_msg = eventarc.GetChannelConnectionRequest( name='name_value', ) + assert args[0] == request_msg def test_get_channel_connection_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5637,7 +5664,11 @@ async def test_get_channel_connection_async_use_cached_wrapped_rpc(transport: st assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetChannelConnectionRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetChannelConnectionRequest({ }), + { }, +]) +async def test_get_channel_connection_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5645,7 +5676,7 @@ async def test_get_channel_connection_async(transport: str = 'grpc_asyncio', req # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5673,11 +5704,6 @@ async def test_get_channel_connection_async(transport: str = 'grpc_asyncio', req assert response.channel == 'channel_value' assert response.activation_token == 'activation_token_value' - -@pytest.mark.asyncio -async def test_get_channel_connection_async_from_dict(): - await test_get_channel_connection_async(request_type=dict) - def test_get_channel_connection_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5824,8 +5850,10 @@ async def test_get_channel_connection_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListChannelConnectionsRequest, - dict, + eventarc.ListChannelConnectionsRequest({ + }), + { + }, ]) def test_list_channel_connections(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -5835,7 +5863,7 @@ def test_list_channel_connections(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5884,10 +5912,11 @@ def test_list_channel_connections_non_empty_request_with_auto_populated_field(): client.list_channel_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListChannelConnectionsRequest( + request_msg = eventarc.ListChannelConnectionsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_channel_connections_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5956,7 +5985,11 @@ async def test_list_channel_connections_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_channel_connections_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListChannelConnectionsRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListChannelConnectionsRequest({ }), + { }, +]) +async def test_list_channel_connections_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5964,7 +5997,7 @@ async def test_list_channel_connections_async(transport: str = 'grpc_asyncio', r # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5988,11 +6021,6 @@ async def test_list_channel_connections_async(transport: str = 'grpc_asyncio', r assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_channel_connections_async_from_dict(): - await test_list_channel_connections_async(request_type=dict) - def test_list_channel_connections_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6333,8 +6361,10 @@ async def test_list_channel_connections_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateChannelConnectionRequest, - dict, + eventarc.CreateChannelConnectionRequest({ + }), + { + }, ]) def test_create_channel_connection(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -6344,7 +6374,7 @@ def test_create_channel_connection(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6388,10 +6418,11 @@ def test_create_channel_connection_non_empty_request_with_auto_populated_field() client.create_channel_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateChannelConnectionRequest( + request_msg = eventarc.CreateChannelConnectionRequest( parent='parent_value', channel_connection_id='channel_connection_id_value', ) + assert args[0] == request_msg def test_create_channel_connection_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6470,7 +6501,11 @@ async def test_create_channel_connection_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateChannelConnectionRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreateChannelConnectionRequest({ }), + { }, +]) +async def test_create_channel_connection_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6478,7 +6513,7 @@ async def test_create_channel_connection_async(transport: str = 'grpc_asyncio', # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6499,11 +6534,6 @@ async def test_create_channel_connection_async(transport: str = 'grpc_asyncio', # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_channel_connection_async_from_dict(): - await test_create_channel_connection_async(request_type=dict) - def test_create_channel_connection_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6672,8 +6702,10 @@ async def test_create_channel_connection_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteChannelConnectionRequest, - dict, + eventarc.DeleteChannelConnectionRequest({ + }), + { + }, ]) def test_delete_channel_connection(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -6683,7 +6715,7 @@ def test_delete_channel_connection(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6726,9 +6758,10 @@ def test_delete_channel_connection_non_empty_request_with_auto_populated_field() client.delete_channel_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteChannelConnectionRequest( + request_msg = eventarc.DeleteChannelConnectionRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_channel_connection_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6807,7 +6840,11 @@ async def test_delete_channel_connection_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteChannelConnectionRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeleteChannelConnectionRequest({ }), + { }, +]) +async def test_delete_channel_connection_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6815,7 +6852,7 @@ async def test_delete_channel_connection_async(transport: str = 'grpc_asyncio', # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6836,11 +6873,6 @@ async def test_delete_channel_connection_async(transport: str = 'grpc_asyncio', # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_channel_connection_async_from_dict(): - await test_delete_channel_connection_async(request_type=dict) - def test_delete_channel_connection_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6989,8 +7021,10 @@ async def test_delete_channel_connection_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetGoogleChannelConfigRequest, - dict, + eventarc.GetGoogleChannelConfigRequest({ + }), + { + }, ]) def test_get_google_channel_config(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7000,7 +7034,7 @@ def test_get_google_channel_config(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7048,9 +7082,10 @@ def test_get_google_channel_config_non_empty_request_with_auto_populated_field() client.get_google_channel_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetGoogleChannelConfigRequest( + request_msg = eventarc.GetGoogleChannelConfigRequest( name='name_value', ) + assert args[0] == request_msg def test_get_google_channel_config_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7119,7 +7154,11 @@ async def test_get_google_channel_config_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_google_channel_config_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetGoogleChannelConfigRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetGoogleChannelConfigRequest({ }), + { }, +]) +async def test_get_google_channel_config_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7127,7 +7166,7 @@ async def test_get_google_channel_config_async(transport: str = 'grpc_asyncio', # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7151,11 +7190,6 @@ async def test_get_google_channel_config_async(transport: str = 'grpc_asyncio', assert response.name == 'name_value' assert response.crypto_key_name == 'crypto_key_name_value' - -@pytest.mark.asyncio -async def test_get_google_channel_config_async_from_dict(): - await test_get_google_channel_config_async(request_type=dict) - def test_get_google_channel_config_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7302,8 +7336,10 @@ async def test_get_google_channel_config_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateGoogleChannelConfigRequest, - dict, + eventarc.UpdateGoogleChannelConfigRequest({ + }), + { + }, ]) def test_update_google_channel_config(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7313,7 +7349,7 @@ def test_update_google_channel_config(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7360,8 +7396,9 @@ def test_update_google_channel_config_non_empty_request_with_auto_populated_fiel client.update_google_channel_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateGoogleChannelConfigRequest( + request_msg = eventarc.UpdateGoogleChannelConfigRequest( ) + assert args[0] == request_msg def test_update_google_channel_config_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7430,7 +7467,11 @@ async def test_update_google_channel_config_async_use_cached_wrapped_rpc(transpo assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_google_channel_config_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateGoogleChannelConfigRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdateGoogleChannelConfigRequest({ }), + { }, +]) +async def test_update_google_channel_config_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7438,7 +7479,7 @@ async def test_update_google_channel_config_async(transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7462,11 +7503,6 @@ async def test_update_google_channel_config_async(transport: str = 'grpc_asyncio assert response.name == 'name_value' assert response.crypto_key_name == 'crypto_key_name_value' - -@pytest.mark.asyncio -async def test_update_google_channel_config_async_from_dict(): - await test_update_google_channel_config_async(request_type=dict) - def test_update_google_channel_config_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7623,8 +7659,10 @@ async def test_update_google_channel_config_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetMessageBusRequest, - dict, + eventarc.GetMessageBusRequest({ + }), + { + }, ]) def test_get_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7634,7 +7672,7 @@ def test_get_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7688,9 +7726,10 @@ def test_get_message_bus_non_empty_request_with_auto_populated_field(): client.get_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetMessageBusRequest( + request_msg = eventarc.GetMessageBusRequest( name='name_value', ) + assert args[0] == request_msg def test_get_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7759,7 +7798,11 @@ async def test_get_message_bus_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetMessageBusRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetMessageBusRequest({ }), + { }, +]) +async def test_get_message_bus_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7767,7 +7810,7 @@ async def test_get_message_bus_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7797,11 +7840,6 @@ async def test_get_message_bus_async(transport: str = 'grpc_asyncio', request_ty assert response.display_name == 'display_name_value' assert response.crypto_key_name == 'crypto_key_name_value' - -@pytest.mark.asyncio -async def test_get_message_bus_async_from_dict(): - await test_get_message_bus_async(request_type=dict) - def test_get_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7948,8 +7986,10 @@ async def test_get_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListMessageBusesRequest, - dict, + eventarc.ListMessageBusesRequest({ + }), + { + }, ]) def test_list_message_buses(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -7959,7 +7999,7 @@ def test_list_message_buses(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8010,12 +8050,13 @@ def test_list_message_buses_non_empty_request_with_auto_populated_field(): client.list_message_buses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListMessageBusesRequest( + request_msg = eventarc.ListMessageBusesRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) + assert args[0] == request_msg def test_list_message_buses_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8084,7 +8125,11 @@ async def test_list_message_buses_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_message_buses_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListMessageBusesRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListMessageBusesRequest({ }), + { }, +]) +async def test_list_message_buses_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8092,7 +8137,7 @@ async def test_list_message_buses_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8116,11 +8161,6 @@ async def test_list_message_buses_async(transport: str = 'grpc_asyncio', request assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_message_buses_async_from_dict(): - await test_list_message_buses_async(request_type=dict) - def test_list_message_buses_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8461,8 +8501,10 @@ async def test_list_message_buses_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.ListMessageBusEnrollmentsRequest, - dict, + eventarc.ListMessageBusEnrollmentsRequest({ + }), + { + }, ]) def test_list_message_bus_enrollments(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -8472,7 +8514,7 @@ def test_list_message_bus_enrollments(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8523,10 +8565,11 @@ def test_list_message_bus_enrollments_non_empty_request_with_auto_populated_fiel client.list_message_bus_enrollments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListMessageBusEnrollmentsRequest( + request_msg = eventarc.ListMessageBusEnrollmentsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_message_bus_enrollments_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8595,7 +8638,11 @@ async def test_list_message_bus_enrollments_async_use_cached_wrapped_rpc(transpo assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_message_bus_enrollments_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListMessageBusEnrollmentsRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListMessageBusEnrollmentsRequest({ }), + { }, +]) +async def test_list_message_bus_enrollments_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8603,7 +8650,7 @@ async def test_list_message_bus_enrollments_async(transport: str = 'grpc_asyncio # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8629,11 +8676,6 @@ async def test_list_message_bus_enrollments_async(transport: str = 'grpc_asyncio assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_message_bus_enrollments_async_from_dict(): - await test_list_message_bus_enrollments_async(request_type=dict) - def test_list_message_bus_enrollments_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8974,8 +9016,10 @@ async def test_list_message_bus_enrollments_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateMessageBusRequest, - dict, + eventarc.CreateMessageBusRequest({ + }), + { + }, ]) def test_create_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -8985,7 +9029,7 @@ def test_create_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9029,10 +9073,11 @@ def test_create_message_bus_non_empty_request_with_auto_populated_field(): client.create_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateMessageBusRequest( + request_msg = eventarc.CreateMessageBusRequest( parent='parent_value', message_bus_id='message_bus_id_value', ) + assert args[0] == request_msg def test_create_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9111,7 +9156,11 @@ async def test_create_message_bus_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateMessageBusRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreateMessageBusRequest({ }), + { }, +]) +async def test_create_message_bus_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9119,7 +9168,7 @@ async def test_create_message_bus_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9140,11 +9189,6 @@ async def test_create_message_bus_async(transport: str = 'grpc_asyncio', request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_message_bus_async_from_dict(): - await test_create_message_bus_async(request_type=dict) - def test_create_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9313,8 +9357,10 @@ async def test_create_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateMessageBusRequest, - dict, + eventarc.UpdateMessageBusRequest({ + }), + { + }, ]) def test_update_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -9324,7 +9370,7 @@ def test_update_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9366,8 +9412,9 @@ def test_update_message_bus_non_empty_request_with_auto_populated_field(): client.update_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateMessageBusRequest( + request_msg = eventarc.UpdateMessageBusRequest( ) + assert args[0] == request_msg def test_update_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9446,7 +9493,11 @@ async def test_update_message_bus_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateMessageBusRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdateMessageBusRequest({ }), + { }, +]) +async def test_update_message_bus_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9454,7 +9505,7 @@ async def test_update_message_bus_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9475,11 +9526,6 @@ async def test_update_message_bus_async(transport: str = 'grpc_asyncio', request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_message_bus_async_from_dict(): - await test_update_message_bus_async(request_type=dict) - def test_update_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9638,8 +9684,10 @@ async def test_update_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteMessageBusRequest, - dict, + eventarc.DeleteMessageBusRequest({ + }), + { + }, ]) def test_delete_message_bus(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -9649,7 +9697,7 @@ def test_delete_message_bus(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9693,10 +9741,11 @@ def test_delete_message_bus_non_empty_request_with_auto_populated_field(): client.delete_message_bus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteMessageBusRequest( + request_msg = eventarc.DeleteMessageBusRequest( name='name_value', etag='etag_value', ) + assert args[0] == request_msg def test_delete_message_bus_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9775,7 +9824,11 @@ async def test_delete_message_bus_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_message_bus_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteMessageBusRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeleteMessageBusRequest({ }), + { }, +]) +async def test_delete_message_bus_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9783,7 +9836,7 @@ async def test_delete_message_bus_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9804,11 +9857,6 @@ async def test_delete_message_bus_async(transport: str = 'grpc_asyncio', request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_message_bus_async_from_dict(): - await test_delete_message_bus_async(request_type=dict) - def test_delete_message_bus_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9967,8 +10015,10 @@ async def test_delete_message_bus_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetEnrollmentRequest, - dict, + eventarc.GetEnrollmentRequest({ + }), + { + }, ]) def test_get_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -9978,7 +10028,7 @@ def test_get_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10036,9 +10086,10 @@ def test_get_enrollment_non_empty_request_with_auto_populated_field(): client.get_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetEnrollmentRequest( + request_msg = eventarc.GetEnrollmentRequest( name='name_value', ) + assert args[0] == request_msg def test_get_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10107,7 +10158,11 @@ async def test_get_enrollment_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetEnrollmentRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetEnrollmentRequest({ }), + { }, +]) +async def test_get_enrollment_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10115,7 +10170,7 @@ async def test_get_enrollment_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10149,11 +10204,6 @@ async def test_get_enrollment_async(transport: str = 'grpc_asyncio', request_typ assert response.message_bus == 'message_bus_value' assert response.destination == 'destination_value' - -@pytest.mark.asyncio -async def test_get_enrollment_async_from_dict(): - await test_get_enrollment_async(request_type=dict) - def test_get_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10300,8 +10350,10 @@ async def test_get_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListEnrollmentsRequest, - dict, + eventarc.ListEnrollmentsRequest({ + }), + { + }, ]) def test_list_enrollments(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -10311,7 +10363,7 @@ def test_list_enrollments(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10362,12 +10414,13 @@ def test_list_enrollments_non_empty_request_with_auto_populated_field(): client.list_enrollments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListEnrollmentsRequest( + request_msg = eventarc.ListEnrollmentsRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) + assert args[0] == request_msg def test_list_enrollments_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10436,7 +10489,11 @@ async def test_list_enrollments_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_enrollments_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListEnrollmentsRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListEnrollmentsRequest({ }), + { }, +]) +async def test_list_enrollments_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10444,7 +10501,7 @@ async def test_list_enrollments_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10468,11 +10525,6 @@ async def test_list_enrollments_async(transport: str = 'grpc_asyncio', request_t assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_enrollments_async_from_dict(): - await test_list_enrollments_async(request_type=dict) - def test_list_enrollments_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10813,8 +10865,10 @@ async def test_list_enrollments_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateEnrollmentRequest, - dict, + eventarc.CreateEnrollmentRequest({ + }), + { + }, ]) def test_create_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -10824,7 +10878,7 @@ def test_create_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10868,10 +10922,11 @@ def test_create_enrollment_non_empty_request_with_auto_populated_field(): client.create_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateEnrollmentRequest( + request_msg = eventarc.CreateEnrollmentRequest( parent='parent_value', enrollment_id='enrollment_id_value', ) + assert args[0] == request_msg def test_create_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10950,7 +11005,11 @@ async def test_create_enrollment_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateEnrollmentRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreateEnrollmentRequest({ }), + { }, +]) +async def test_create_enrollment_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10958,7 +11017,7 @@ async def test_create_enrollment_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10979,11 +11038,6 @@ async def test_create_enrollment_async(transport: str = 'grpc_asyncio', request_ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_enrollment_async_from_dict(): - await test_create_enrollment_async(request_type=dict) - def test_create_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11152,8 +11206,10 @@ async def test_create_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateEnrollmentRequest, - dict, + eventarc.UpdateEnrollmentRequest({ + }), + { + }, ]) def test_update_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -11163,7 +11219,7 @@ def test_update_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11205,8 +11261,9 @@ def test_update_enrollment_non_empty_request_with_auto_populated_field(): client.update_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateEnrollmentRequest( + request_msg = eventarc.UpdateEnrollmentRequest( ) + assert args[0] == request_msg def test_update_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11285,7 +11342,11 @@ async def test_update_enrollment_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateEnrollmentRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdateEnrollmentRequest({ }), + { }, +]) +async def test_update_enrollment_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11293,7 +11354,7 @@ async def test_update_enrollment_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11314,11 +11375,6 @@ async def test_update_enrollment_async(transport: str = 'grpc_asyncio', request_ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_enrollment_async_from_dict(): - await test_update_enrollment_async(request_type=dict) - def test_update_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11477,8 +11533,10 @@ async def test_update_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteEnrollmentRequest, - dict, + eventarc.DeleteEnrollmentRequest({ + }), + { + }, ]) def test_delete_enrollment(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -11488,7 +11546,7 @@ def test_delete_enrollment(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11532,10 +11590,11 @@ def test_delete_enrollment_non_empty_request_with_auto_populated_field(): client.delete_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteEnrollmentRequest( + request_msg = eventarc.DeleteEnrollmentRequest( name='name_value', etag='etag_value', ) + assert args[0] == request_msg def test_delete_enrollment_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11614,7 +11673,11 @@ async def test_delete_enrollment_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_enrollment_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteEnrollmentRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeleteEnrollmentRequest({ }), + { }, +]) +async def test_delete_enrollment_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11622,7 +11685,7 @@ async def test_delete_enrollment_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11643,11 +11706,6 @@ async def test_delete_enrollment_async(transport: str = 'grpc_asyncio', request_ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_enrollment_async_from_dict(): - await test_delete_enrollment_async(request_type=dict) - def test_delete_enrollment_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11806,8 +11864,10 @@ async def test_delete_enrollment_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetPipelineRequest, - dict, + eventarc.GetPipelineRequest({ + }), + { + }, ]) def test_get_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -11817,7 +11877,7 @@ def test_get_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11873,9 +11933,10 @@ def test_get_pipeline_non_empty_request_with_auto_populated_field(): client.get_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetPipelineRequest( + request_msg = eventarc.GetPipelineRequest( name='name_value', ) + assert args[0] == request_msg def test_get_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -11944,7 +12005,11 @@ async def test_get_pipeline_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetPipelineRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetPipelineRequest({ }), + { }, +]) +async def test_get_pipeline_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11952,7 +12017,7 @@ async def test_get_pipeline_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11984,11 +12049,6 @@ async def test_get_pipeline_async(transport: str = 'grpc_asyncio', request_type= assert response.etag == 'etag_value' assert response.satisfies_pzs is True - -@pytest.mark.asyncio -async def test_get_pipeline_async_from_dict(): - await test_get_pipeline_async(request_type=dict) - def test_get_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12135,8 +12195,10 @@ async def test_get_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListPipelinesRequest, - dict, + eventarc.ListPipelinesRequest({ + }), + { + }, ]) def test_list_pipelines(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -12146,7 +12208,7 @@ def test_list_pipelines(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12197,12 +12259,13 @@ def test_list_pipelines_non_empty_request_with_auto_populated_field(): client.list_pipelines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListPipelinesRequest( + request_msg = eventarc.ListPipelinesRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) + assert args[0] == request_msg def test_list_pipelines_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -12271,7 +12334,11 @@ async def test_list_pipelines_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_pipelines_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListPipelinesRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListPipelinesRequest({ }), + { }, +]) +async def test_list_pipelines_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12279,7 +12346,7 @@ async def test_list_pipelines_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12303,11 +12370,6 @@ async def test_list_pipelines_async(transport: str = 'grpc_asyncio', request_typ assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_pipelines_async_from_dict(): - await test_list_pipelines_async(request_type=dict) - def test_list_pipelines_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12648,8 +12710,10 @@ async def test_list_pipelines_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreatePipelineRequest, - dict, + eventarc.CreatePipelineRequest({ + }), + { + }, ]) def test_create_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -12659,7 +12723,7 @@ def test_create_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12703,10 +12767,11 @@ def test_create_pipeline_non_empty_request_with_auto_populated_field(): client.create_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreatePipelineRequest( + request_msg = eventarc.CreatePipelineRequest( parent='parent_value', pipeline_id='pipeline_id_value', ) + assert args[0] == request_msg def test_create_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -12785,7 +12850,11 @@ async def test_create_pipeline_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreatePipelineRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreatePipelineRequest({ }), + { }, +]) +async def test_create_pipeline_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12793,7 +12862,7 @@ async def test_create_pipeline_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12814,11 +12883,6 @@ async def test_create_pipeline_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_pipeline_async_from_dict(): - await test_create_pipeline_async(request_type=dict) - def test_create_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12987,8 +13051,10 @@ async def test_create_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdatePipelineRequest, - dict, + eventarc.UpdatePipelineRequest({ + }), + { + }, ]) def test_update_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -12998,7 +13064,7 @@ def test_update_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13040,8 +13106,9 @@ def test_update_pipeline_non_empty_request_with_auto_populated_field(): client.update_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdatePipelineRequest( + request_msg = eventarc.UpdatePipelineRequest( ) + assert args[0] == request_msg def test_update_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -13120,7 +13187,11 @@ async def test_update_pipeline_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdatePipelineRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdatePipelineRequest({ }), + { }, +]) +async def test_update_pipeline_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13128,7 +13199,7 @@ async def test_update_pipeline_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13149,11 +13220,6 @@ async def test_update_pipeline_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_pipeline_async_from_dict(): - await test_update_pipeline_async(request_type=dict) - def test_update_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13312,8 +13378,10 @@ async def test_update_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeletePipelineRequest, - dict, + eventarc.DeletePipelineRequest({ + }), + { + }, ]) def test_delete_pipeline(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -13323,7 +13391,7 @@ def test_delete_pipeline(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13367,10 +13435,11 @@ def test_delete_pipeline_non_empty_request_with_auto_populated_field(): client.delete_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeletePipelineRequest( + request_msg = eventarc.DeletePipelineRequest( name='name_value', etag='etag_value', ) + assert args[0] == request_msg def test_delete_pipeline_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -13449,7 +13518,11 @@ async def test_delete_pipeline_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_pipeline_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeletePipelineRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeletePipelineRequest({ }), + { }, +]) +async def test_delete_pipeline_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13457,7 +13530,7 @@ async def test_delete_pipeline_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13478,11 +13551,6 @@ async def test_delete_pipeline_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_pipeline_async_from_dict(): - await test_delete_pipeline_async(request_type=dict) - def test_delete_pipeline_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13641,8 +13709,10 @@ async def test_delete_pipeline_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.GetGoogleApiSourceRequest, - dict, + eventarc.GetGoogleApiSourceRequest({ + }), + { + }, ]) def test_get_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -13652,7 +13722,7 @@ def test_get_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13708,9 +13778,10 @@ def test_get_google_api_source_non_empty_request_with_auto_populated_field(): client.get_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetGoogleApiSourceRequest( + request_msg = eventarc.GetGoogleApiSourceRequest( name='name_value', ) + assert args[0] == request_msg def test_get_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -13779,7 +13850,11 @@ async def test_get_google_api_source_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetGoogleApiSourceRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.GetGoogleApiSourceRequest({ }), + { }, +]) +async def test_get_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13787,7 +13862,7 @@ async def test_get_google_api_source_async(transport: str = 'grpc_asyncio', requ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13819,11 +13894,6 @@ async def test_get_google_api_source_async(transport: str = 'grpc_asyncio', requ assert response.destination == 'destination_value' assert response.crypto_key_name == 'crypto_key_name_value' - -@pytest.mark.asyncio -async def test_get_google_api_source_async_from_dict(): - await test_get_google_api_source_async(request_type=dict) - def test_get_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13970,8 +14040,10 @@ async def test_get_google_api_source_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.ListGoogleApiSourcesRequest, - dict, + eventarc.ListGoogleApiSourcesRequest({ + }), + { + }, ]) def test_list_google_api_sources(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -13981,7 +14053,7 @@ def test_list_google_api_sources(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14032,12 +14104,13 @@ def test_list_google_api_sources_non_empty_request_with_auto_populated_field(): client.list_google_api_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListGoogleApiSourcesRequest( + request_msg = eventarc.ListGoogleApiSourcesRequest( parent='parent_value', page_token='page_token_value', order_by='order_by_value', filter='filter_value', ) + assert args[0] == request_msg def test_list_google_api_sources_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -14106,7 +14179,11 @@ async def test_list_google_api_sources_async_use_cached_wrapped_rpc(transport: s assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_google_api_sources_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListGoogleApiSourcesRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.ListGoogleApiSourcesRequest({ }), + { }, +]) +async def test_list_google_api_sources_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14114,7 +14191,7 @@ async def test_list_google_api_sources_async(transport: str = 'grpc_asyncio', re # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14138,11 +14215,6 @@ async def test_list_google_api_sources_async(transport: str = 'grpc_asyncio', re assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_google_api_sources_async_from_dict(): - await test_list_google_api_sources_async(request_type=dict) - def test_list_google_api_sources_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14483,8 +14555,10 @@ async def test_list_google_api_sources_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - eventarc.CreateGoogleApiSourceRequest, - dict, + eventarc.CreateGoogleApiSourceRequest({ + }), + { + }, ]) def test_create_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -14494,7 +14568,7 @@ def test_create_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14538,10 +14612,11 @@ def test_create_google_api_source_non_empty_request_with_auto_populated_field(): client.create_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateGoogleApiSourceRequest( + request_msg = eventarc.CreateGoogleApiSourceRequest( parent='parent_value', google_api_source_id='google_api_source_id_value', ) + assert args[0] == request_msg def test_create_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -14620,7 +14695,11 @@ async def test_create_google_api_source_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateGoogleApiSourceRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.CreateGoogleApiSourceRequest({ }), + { }, +]) +async def test_create_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14628,7 +14707,7 @@ async def test_create_google_api_source_async(transport: str = 'grpc_asyncio', r # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14649,11 +14728,6 @@ async def test_create_google_api_source_async(transport: str = 'grpc_asyncio', r # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_google_api_source_async_from_dict(): - await test_create_google_api_source_async(request_type=dict) - def test_create_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14822,8 +14896,10 @@ async def test_create_google_api_source_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.UpdateGoogleApiSourceRequest, - dict, + eventarc.UpdateGoogleApiSourceRequest({ + }), + { + }, ]) def test_update_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -14833,7 +14909,7 @@ def test_update_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14875,8 +14951,9 @@ def test_update_google_api_source_non_empty_request_with_auto_populated_field(): client.update_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateGoogleApiSourceRequest( + request_msg = eventarc.UpdateGoogleApiSourceRequest( ) + assert args[0] == request_msg def test_update_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -14955,7 +15032,11 @@ async def test_update_google_api_source_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateGoogleApiSourceRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.UpdateGoogleApiSourceRequest({ }), + { }, +]) +async def test_update_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14963,7 +15044,7 @@ async def test_update_google_api_source_async(transport: str = 'grpc_asyncio', r # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14984,11 +15065,6 @@ async def test_update_google_api_source_async(transport: str = 'grpc_asyncio', r # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_google_api_source_async_from_dict(): - await test_update_google_api_source_async(request_type=dict) - def test_update_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15147,8 +15223,10 @@ async def test_update_google_api_source_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - eventarc.DeleteGoogleApiSourceRequest, - dict, + eventarc.DeleteGoogleApiSourceRequest({ + }), + { + }, ]) def test_delete_google_api_source(request_type, transport: str = 'grpc'): client = EventarcClient( @@ -15158,7 +15236,7 @@ def test_delete_google_api_source(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15202,10 +15280,11 @@ def test_delete_google_api_source_non_empty_request_with_auto_populated_field(): client.delete_google_api_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteGoogleApiSourceRequest( + request_msg = eventarc.DeleteGoogleApiSourceRequest( name='name_value', etag='etag_value', ) + assert args[0] == request_msg def test_delete_google_api_source_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -15284,7 +15363,11 @@ async def test_delete_google_api_source_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_google_api_source_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteGoogleApiSourceRequest): +@pytest.mark.parametrize("request_type", [ + eventarc.DeleteGoogleApiSourceRequest({ }), + { }, +]) +async def test_delete_google_api_source_async(request_type, transport: str = 'grpc_asyncio'): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15292,7 +15375,7 @@ async def test_delete_google_api_source_async(transport: str = 'grpc_asyncio', r # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15313,11 +15396,6 @@ async def test_delete_google_api_source_async(transport: str = 'grpc_asyncio', r # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_google_api_source_async_from_dict(): - await test_delete_google_api_source_async(request_type=dict) - def test_delete_google_api_source_field_headers(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22630,7 +22708,6 @@ def test_get_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() - assert args[0] == request_msg @@ -22653,7 +22730,6 @@ def test_list_triggers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() - assert args[0] == request_msg @@ -22676,7 +22752,6 @@ def test_create_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() - assert args[0] == request_msg @@ -22699,7 +22774,6 @@ def test_update_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() - assert args[0] == request_msg @@ -22722,7 +22796,6 @@ def test_delete_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() - assert args[0] == request_msg @@ -22745,7 +22818,6 @@ def test_get_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() - assert args[0] == request_msg @@ -22768,7 +22840,6 @@ def test_list_channels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() - assert args[0] == request_msg @@ -22791,7 +22862,6 @@ def test_create_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() - assert args[0] == request_msg @@ -22814,7 +22884,6 @@ def test_update_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() - assert args[0] == request_msg @@ -22837,7 +22906,6 @@ def test_delete_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() - assert args[0] == request_msg @@ -22860,7 +22928,6 @@ def test_get_provider_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() - assert args[0] == request_msg @@ -22883,7 +22950,6 @@ def test_list_providers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() - assert args[0] == request_msg @@ -22906,7 +22972,6 @@ def test_get_channel_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() - assert args[0] == request_msg @@ -22929,7 +22994,6 @@ def test_list_channel_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() - assert args[0] == request_msg @@ -22952,7 +23016,6 @@ def test_create_channel_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() - assert args[0] == request_msg @@ -22975,7 +23038,6 @@ def test_delete_channel_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() - assert args[0] == request_msg @@ -22998,7 +23060,6 @@ def test_get_google_channel_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() - assert args[0] == request_msg @@ -23021,7 +23082,6 @@ def test_update_google_channel_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() - assert args[0] == request_msg @@ -23044,7 +23104,6 @@ def test_get_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetMessageBusRequest() - assert args[0] == request_msg @@ -23067,7 +23126,6 @@ def test_list_message_buses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusesRequest() - assert args[0] == request_msg @@ -23090,7 +23148,6 @@ def test_list_message_bus_enrollments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusEnrollmentsRequest() - assert args[0] == request_msg @@ -23113,7 +23170,6 @@ def test_create_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateMessageBusRequest() - assert args[0] == request_msg @@ -23136,7 +23192,6 @@ def test_update_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateMessageBusRequest() - assert args[0] == request_msg @@ -23159,7 +23214,6 @@ def test_delete_message_bus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteMessageBusRequest() - assert args[0] == request_msg @@ -23182,7 +23236,6 @@ def test_get_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetEnrollmentRequest() - assert args[0] == request_msg @@ -23205,7 +23258,6 @@ def test_list_enrollments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListEnrollmentsRequest() - assert args[0] == request_msg @@ -23228,7 +23280,6 @@ def test_create_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateEnrollmentRequest() - assert args[0] == request_msg @@ -23251,7 +23302,6 @@ def test_update_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateEnrollmentRequest() - assert args[0] == request_msg @@ -23274,7 +23324,6 @@ def test_delete_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteEnrollmentRequest() - assert args[0] == request_msg @@ -23297,7 +23346,6 @@ def test_get_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetPipelineRequest() - assert args[0] == request_msg @@ -23320,7 +23368,6 @@ def test_list_pipelines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListPipelinesRequest() - assert args[0] == request_msg @@ -23343,7 +23390,6 @@ def test_create_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreatePipelineRequest() - assert args[0] == request_msg @@ -23366,7 +23412,6 @@ def test_update_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdatePipelineRequest() - assert args[0] == request_msg @@ -23389,7 +23434,6 @@ def test_delete_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeletePipelineRequest() - assert args[0] == request_msg @@ -23412,7 +23456,6 @@ def test_get_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleApiSourceRequest() - assert args[0] == request_msg @@ -23435,7 +23478,6 @@ def test_list_google_api_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListGoogleApiSourcesRequest() - assert args[0] == request_msg @@ -23458,7 +23500,6 @@ def test_create_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateGoogleApiSourceRequest() - assert args[0] == request_msg @@ -23481,7 +23522,6 @@ def test_update_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleApiSourceRequest() - assert args[0] == request_msg @@ -23504,7 +23544,6 @@ def test_delete_google_api_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteGoogleApiSourceRequest() - assert args[0] == request_msg @@ -23552,7 +23591,6 @@ async def test_get_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() - assert args[0] == request_msg @@ -23580,7 +23618,6 @@ async def test_list_triggers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() - assert args[0] == request_msg @@ -23607,7 +23644,6 @@ async def test_create_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() - assert args[0] == request_msg @@ -23634,7 +23670,6 @@ async def test_update_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() - assert args[0] == request_msg @@ -23661,7 +23696,6 @@ async def test_delete_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() - assert args[0] == request_msg @@ -23694,7 +23728,6 @@ async def test_get_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() - assert args[0] == request_msg @@ -23722,7 +23755,6 @@ async def test_list_channels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() - assert args[0] == request_msg @@ -23749,7 +23781,6 @@ async def test_create_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() - assert args[0] == request_msg @@ -23776,7 +23807,6 @@ async def test_update_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() - assert args[0] == request_msg @@ -23803,7 +23833,6 @@ async def test_delete_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() - assert args[0] == request_msg @@ -23831,7 +23860,6 @@ async def test_get_provider_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() - assert args[0] == request_msg @@ -23859,7 +23887,6 @@ async def test_list_providers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() - assert args[0] == request_msg @@ -23889,7 +23916,6 @@ async def test_get_channel_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() - assert args[0] == request_msg @@ -23917,7 +23943,6 @@ async def test_list_channel_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() - assert args[0] == request_msg @@ -23944,7 +23969,6 @@ async def test_create_channel_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() - assert args[0] == request_msg @@ -23971,7 +23995,6 @@ async def test_delete_channel_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() - assert args[0] == request_msg @@ -23999,7 +24022,6 @@ async def test_get_google_channel_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() - assert args[0] == request_msg @@ -24027,7 +24049,6 @@ async def test_update_google_channel_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() - assert args[0] == request_msg @@ -24058,7 +24079,6 @@ async def test_get_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetMessageBusRequest() - assert args[0] == request_msg @@ -24086,7 +24106,6 @@ async def test_list_message_buses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusesRequest() - assert args[0] == request_msg @@ -24115,7 +24134,6 @@ async def test_list_message_bus_enrollments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusEnrollmentsRequest() - assert args[0] == request_msg @@ -24142,7 +24160,6 @@ async def test_create_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateMessageBusRequest() - assert args[0] == request_msg @@ -24169,7 +24186,6 @@ async def test_update_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateMessageBusRequest() - assert args[0] == request_msg @@ -24196,7 +24212,6 @@ async def test_delete_message_bus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteMessageBusRequest() - assert args[0] == request_msg @@ -24229,7 +24244,6 @@ async def test_get_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetEnrollmentRequest() - assert args[0] == request_msg @@ -24257,7 +24271,6 @@ async def test_list_enrollments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListEnrollmentsRequest() - assert args[0] == request_msg @@ -24284,7 +24297,6 @@ async def test_create_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateEnrollmentRequest() - assert args[0] == request_msg @@ -24311,7 +24323,6 @@ async def test_update_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateEnrollmentRequest() - assert args[0] == request_msg @@ -24338,7 +24349,6 @@ async def test_delete_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteEnrollmentRequest() - assert args[0] == request_msg @@ -24370,7 +24380,6 @@ async def test_get_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetPipelineRequest() - assert args[0] == request_msg @@ -24398,7 +24407,6 @@ async def test_list_pipelines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListPipelinesRequest() - assert args[0] == request_msg @@ -24425,7 +24433,6 @@ async def test_create_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreatePipelineRequest() - assert args[0] == request_msg @@ -24452,7 +24459,6 @@ async def test_update_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdatePipelineRequest() - assert args[0] == request_msg @@ -24479,7 +24485,6 @@ async def test_delete_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeletePipelineRequest() - assert args[0] == request_msg @@ -24511,7 +24516,6 @@ async def test_get_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleApiSourceRequest() - assert args[0] == request_msg @@ -24539,7 +24543,6 @@ async def test_list_google_api_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListGoogleApiSourcesRequest() - assert args[0] == request_msg @@ -24566,7 +24569,6 @@ async def test_create_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateGoogleApiSourceRequest() - assert args[0] == request_msg @@ -24593,7 +24595,6 @@ async def test_update_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleApiSourceRequest() - assert args[0] == request_msg @@ -24620,7 +24621,6 @@ async def test_delete_google_api_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteGoogleApiSourceRequest() - assert args[0] == request_msg @@ -30160,7 +30160,6 @@ def test_get_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() - assert args[0] == request_msg @@ -30182,7 +30181,6 @@ def test_list_triggers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() - assert args[0] == request_msg @@ -30204,7 +30202,6 @@ def test_create_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() - assert args[0] == request_msg @@ -30226,7 +30223,6 @@ def test_update_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() - assert args[0] == request_msg @@ -30248,7 +30244,6 @@ def test_delete_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() - assert args[0] == request_msg @@ -30270,7 +30265,6 @@ def test_get_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() - assert args[0] == request_msg @@ -30292,7 +30286,6 @@ def test_list_channels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() - assert args[0] == request_msg @@ -30314,7 +30307,6 @@ def test_create_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() - assert args[0] == request_msg @@ -30336,7 +30328,6 @@ def test_update_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() - assert args[0] == request_msg @@ -30358,7 +30349,6 @@ def test_delete_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() - assert args[0] == request_msg @@ -30380,7 +30370,6 @@ def test_get_provider_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() - assert args[0] == request_msg @@ -30402,7 +30391,6 @@ def test_list_providers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() - assert args[0] == request_msg @@ -30424,7 +30412,6 @@ def test_get_channel_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() - assert args[0] == request_msg @@ -30446,7 +30433,6 @@ def test_list_channel_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() - assert args[0] == request_msg @@ -30468,7 +30454,6 @@ def test_create_channel_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() - assert args[0] == request_msg @@ -30490,7 +30475,6 @@ def test_delete_channel_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() - assert args[0] == request_msg @@ -30512,7 +30496,6 @@ def test_get_google_channel_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() - assert args[0] == request_msg @@ -30534,7 +30517,6 @@ def test_update_google_channel_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() - assert args[0] == request_msg @@ -30556,7 +30538,6 @@ def test_get_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetMessageBusRequest() - assert args[0] == request_msg @@ -30578,7 +30559,6 @@ def test_list_message_buses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusesRequest() - assert args[0] == request_msg @@ -30600,7 +30580,6 @@ def test_list_message_bus_enrollments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListMessageBusEnrollmentsRequest() - assert args[0] == request_msg @@ -30622,7 +30601,6 @@ def test_create_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateMessageBusRequest() - assert args[0] == request_msg @@ -30644,7 +30622,6 @@ def test_update_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateMessageBusRequest() - assert args[0] == request_msg @@ -30666,7 +30643,6 @@ def test_delete_message_bus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteMessageBusRequest() - assert args[0] == request_msg @@ -30688,7 +30664,6 @@ def test_get_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetEnrollmentRequest() - assert args[0] == request_msg @@ -30710,7 +30685,6 @@ def test_list_enrollments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListEnrollmentsRequest() - assert args[0] == request_msg @@ -30732,7 +30706,6 @@ def test_create_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateEnrollmentRequest() - assert args[0] == request_msg @@ -30754,7 +30727,6 @@ def test_update_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateEnrollmentRequest() - assert args[0] == request_msg @@ -30776,7 +30748,6 @@ def test_delete_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteEnrollmentRequest() - assert args[0] == request_msg @@ -30798,7 +30769,6 @@ def test_get_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetPipelineRequest() - assert args[0] == request_msg @@ -30820,7 +30790,6 @@ def test_list_pipelines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListPipelinesRequest() - assert args[0] == request_msg @@ -30842,7 +30811,6 @@ def test_create_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreatePipelineRequest() - assert args[0] == request_msg @@ -30864,7 +30832,6 @@ def test_update_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdatePipelineRequest() - assert args[0] == request_msg @@ -30886,7 +30853,6 @@ def test_delete_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeletePipelineRequest() - assert args[0] == request_msg @@ -30908,7 +30874,6 @@ def test_get_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleApiSourceRequest() - assert args[0] == request_msg @@ -30930,7 +30895,6 @@ def test_list_google_api_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListGoogleApiSourcesRequest() - assert args[0] == request_msg @@ -30952,7 +30916,6 @@ def test_create_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateGoogleApiSourceRequest() - assert args[0] == request_msg @@ -30974,7 +30937,6 @@ def test_update_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleApiSourceRequest() - assert args[0] == request_msg @@ -30996,7 +30958,6 @@ def test_delete_google_api_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteGoogleApiSourceRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index 04dbcf0ae7ee..70f2b1ee57de 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -960,8 +960,10 @@ def test_config_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging_config.ListBucketsRequest, - dict, + logging_config.ListBucketsRequest({ + }), + { + }, ]) def test_list_buckets(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -971,7 +973,7 @@ def test_list_buckets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1018,10 +1020,11 @@ def test_list_buckets_non_empty_request_with_auto_populated_field(): client.list_buckets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListBucketsRequest( + request_msg = logging_config.ListBucketsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_buckets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1090,7 +1093,11 @@ async def test_list_buckets_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListBucketsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListBucketsRequest({ }), + { }, +]) +async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1098,7 +1105,7 @@ async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1120,11 +1127,6 @@ async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type= assert isinstance(response, pagers.ListBucketsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_buckets_async_from_dict(): - await test_list_buckets_async(request_type=dict) - def test_list_buckets_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1465,8 +1467,10 @@ async def test_list_buckets_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetBucketRequest, - dict, + logging_config.GetBucketRequest({ + }), + { + }, ]) def test_get_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -1476,7 +1480,7 @@ def test_get_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1534,9 +1538,10 @@ def test_get_bucket_non_empty_request_with_auto_populated_field(): client.get_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetBucketRequest( + request_msg = logging_config.GetBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_get_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1605,7 +1610,11 @@ async def test_get_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetBucketRequest({ }), + { }, +]) +async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1613,7 +1622,7 @@ async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1647,11 +1656,6 @@ async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=lo assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] - -@pytest.mark.asyncio -async def test_get_bucket_async_from_dict(): - await test_get_bucket_async(request_type=dict) - def test_get_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1716,8 +1720,10 @@ async def test_get_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest, - dict, + logging_config.CreateBucketRequest({ + }), + { + }, ]) def test_create_bucket_async(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -1727,7 +1733,7 @@ def test_create_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1771,10 +1777,11 @@ def test_create_bucket_async_non_empty_request_with_auto_populated_field(): client.create_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest( + request_msg = logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) + assert args[0] == request_msg def test_create_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1853,7 +1860,11 @@ async def test_create_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateBucketRequest({ }), + { }, +]) +async def test_create_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1861,7 +1872,7 @@ async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', reques # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1882,11 +1893,6 @@ async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', reques # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_bucket_async_async_from_dict(): - await test_create_bucket_async_async(request_type=dict) - def test_create_bucket_async_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1951,8 +1957,10 @@ async def test_create_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest, - dict, + logging_config.UpdateBucketRequest({ + }), + { + }, ]) def test_update_bucket_async(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -1962,7 +1970,7 @@ def test_update_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2005,9 +2013,10 @@ def test_update_bucket_async_non_empty_request_with_auto_populated_field(): client.update_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest( + request_msg = logging_config.UpdateBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_update_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2086,7 +2095,11 @@ async def test_update_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateBucketRequest({ }), + { }, +]) +async def test_update_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2094,7 +2107,7 @@ async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', reques # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2115,11 +2128,6 @@ async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', reques # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_bucket_async_async_from_dict(): - await test_update_bucket_async_async(request_type=dict) - def test_update_bucket_async_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2184,8 +2192,10 @@ async def test_update_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest, - dict, + logging_config.CreateBucketRequest({ + }), + { + }, ]) def test_create_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2195,7 +2205,7 @@ def test_create_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2254,10 +2264,11 @@ def test_create_bucket_non_empty_request_with_auto_populated_field(): client.create_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest( + request_msg = logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) + assert args[0] == request_msg def test_create_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2326,7 +2337,11 @@ async def test_create_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateBucketRequest({ }), + { }, +]) +async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2334,7 +2349,7 @@ async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2368,11 +2383,6 @@ async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] - -@pytest.mark.asyncio -async def test_create_bucket_async_from_dict(): - await test_create_bucket_async(request_type=dict) - def test_create_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2437,8 +2447,10 @@ async def test_create_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest, - dict, + logging_config.UpdateBucketRequest({ + }), + { + }, ]) def test_update_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2448,7 +2460,7 @@ def test_update_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2506,9 +2518,10 @@ def test_update_bucket_non_empty_request_with_auto_populated_field(): client.update_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest( + request_msg = logging_config.UpdateBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_update_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2577,7 +2590,11 @@ async def test_update_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateBucketRequest({ }), + { }, +]) +async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2585,7 +2602,7 @@ async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2619,11 +2636,6 @@ async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] - -@pytest.mark.asyncio -async def test_update_bucket_async_from_dict(): - await test_update_bucket_async(request_type=dict) - def test_update_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,8 +2700,10 @@ async def test_update_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteBucketRequest, - dict, + logging_config.DeleteBucketRequest({ + }), + { + }, ]) def test_delete_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2699,7 +2713,7 @@ def test_delete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2742,9 +2756,10 @@ def test_delete_bucket_non_empty_request_with_auto_populated_field(): client.delete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteBucketRequest( + request_msg = logging_config.DeleteBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2813,7 +2828,11 @@ async def test_delete_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteBucketRequest({ }), + { }, +]) +async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2821,7 +2840,7 @@ async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2840,11 +2859,6 @@ async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_bucket_async_from_dict(): - await test_delete_bucket_async(request_type=dict) - def test_delete_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2909,8 +2923,10 @@ async def test_delete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UndeleteBucketRequest, - dict, + logging_config.UndeleteBucketRequest({ + }), + { + }, ]) def test_undelete_bucket(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -2920,7 +2936,7 @@ def test_undelete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2963,9 +2979,10 @@ def test_undelete_bucket_non_empty_request_with_auto_populated_field(): client.undelete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UndeleteBucketRequest( + request_msg = logging_config.UndeleteBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_undelete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3034,7 +3051,11 @@ async def test_undelete_bucket_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UndeleteBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UndeleteBucketRequest({ }), + { }, +]) +async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3042,7 +3063,7 @@ async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3061,11 +3082,6 @@ async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_undelete_bucket_async_from_dict(): - await test_undelete_bucket_async(request_type=dict) - def test_undelete_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3130,8 +3146,10 @@ async def test_undelete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListViewsRequest, - dict, + logging_config.ListViewsRequest({ + }), + { + }, ]) def test_list_views(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -3141,7 +3159,7 @@ def test_list_views(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3188,10 +3206,11 @@ def test_list_views_non_empty_request_with_auto_populated_field(): client.list_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListViewsRequest( + request_msg = logging_config.ListViewsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_views_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3260,7 +3279,11 @@ async def test_list_views_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_views_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListViewsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListViewsRequest({ }), + { }, +]) +async def test_list_views_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3268,7 +3291,7 @@ async def test_list_views_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3290,11 +3313,6 @@ async def test_list_views_async(transport: str = 'grpc_asyncio', request_type=lo assert isinstance(response, pagers.ListViewsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_views_async_from_dict(): - await test_list_views_async(request_type=dict) - def test_list_views_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3635,8 +3653,10 @@ async def test_list_views_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetViewRequest, - dict, + logging_config.GetViewRequest({ + }), + { + }, ]) def test_get_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -3646,7 +3666,7 @@ def test_get_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3696,9 +3716,10 @@ def test_get_view_non_empty_request_with_auto_populated_field(): client.get_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetViewRequest( + request_msg = logging_config.GetViewRequest( name='name_value', ) + assert args[0] == request_msg def test_get_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3767,7 +3788,11 @@ async def test_get_view_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetViewRequest({ }), + { }, +]) +async def test_get_view_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3775,7 +3800,7 @@ async def test_get_view_async(transport: str = 'grpc_asyncio', request_type=logg # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3801,11 +3826,6 @@ async def test_get_view_async(transport: str = 'grpc_asyncio', request_type=logg assert response.description == 'description_value' assert response.filter == 'filter_value' - -@pytest.mark.asyncio -async def test_get_view_async_from_dict(): - await test_get_view_async(request_type=dict) - def test_get_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3870,8 +3890,10 @@ async def test_get_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateViewRequest, - dict, + logging_config.CreateViewRequest({ + }), + { + }, ]) def test_create_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -3881,7 +3903,7 @@ def test_create_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3932,10 +3954,11 @@ def test_create_view_non_empty_request_with_auto_populated_field(): client.create_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateViewRequest( + request_msg = logging_config.CreateViewRequest( parent='parent_value', view_id='view_id_value', ) + assert args[0] == request_msg def test_create_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4004,7 +4027,11 @@ async def test_create_view_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateViewRequest({ }), + { }, +]) +async def test_create_view_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4012,7 +4039,7 @@ async def test_create_view_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4038,11 +4065,6 @@ async def test_create_view_async(transport: str = 'grpc_asyncio', request_type=l assert response.description == 'description_value' assert response.filter == 'filter_value' - -@pytest.mark.asyncio -async def test_create_view_async_from_dict(): - await test_create_view_async(request_type=dict) - def test_create_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4107,8 +4129,10 @@ async def test_create_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateViewRequest, - dict, + logging_config.UpdateViewRequest({ + }), + { + }, ]) def test_update_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -4118,7 +4142,7 @@ def test_update_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4168,9 +4192,10 @@ def test_update_view_non_empty_request_with_auto_populated_field(): client.update_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateViewRequest( + request_msg = logging_config.UpdateViewRequest( name='name_value', ) + assert args[0] == request_msg def test_update_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4239,7 +4264,11 @@ async def test_update_view_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateViewRequest({ }), + { }, +]) +async def test_update_view_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4247,7 +4276,7 @@ async def test_update_view_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4273,11 +4302,6 @@ async def test_update_view_async(transport: str = 'grpc_asyncio', request_type=l assert response.description == 'description_value' assert response.filter == 'filter_value' - -@pytest.mark.asyncio -async def test_update_view_async_from_dict(): - await test_update_view_async(request_type=dict) - def test_update_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4342,8 +4366,10 @@ async def test_update_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteViewRequest, - dict, + logging_config.DeleteViewRequest({ + }), + { + }, ]) def test_delete_view(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -4353,7 +4379,7 @@ def test_delete_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4396,9 +4422,10 @@ def test_delete_view_non_empty_request_with_auto_populated_field(): client.delete_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteViewRequest( + request_msg = logging_config.DeleteViewRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4467,7 +4494,11 @@ async def test_delete_view_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteViewRequest({ }), + { }, +]) +async def test_delete_view_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4475,7 +4506,7 @@ async def test_delete_view_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4494,11 +4525,6 @@ async def test_delete_view_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_view_async_from_dict(): - await test_delete_view_async(request_type=dict) - def test_delete_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4563,8 +4589,10 @@ async def test_delete_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListSinksRequest, - dict, + logging_config.ListSinksRequest({ + }), + { + }, ]) def test_list_sinks(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -4574,7 +4602,7 @@ def test_list_sinks(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4621,10 +4649,11 @@ def test_list_sinks_non_empty_request_with_auto_populated_field(): client.list_sinks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListSinksRequest( + request_msg = logging_config.ListSinksRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_sinks_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4693,7 +4722,11 @@ async def test_list_sinks_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_sinks_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListSinksRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListSinksRequest({ }), + { }, +]) +async def test_list_sinks_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4701,7 +4734,7 @@ async def test_list_sinks_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4723,11 +4756,6 @@ async def test_list_sinks_async(transport: str = 'grpc_asyncio', request_type=lo assert isinstance(response, pagers.ListSinksAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_sinks_async_from_dict(): - await test_list_sinks_async(request_type=dict) - def test_list_sinks_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5068,8 +5096,10 @@ async def test_list_sinks_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetSinkRequest, - dict, + logging_config.GetSinkRequest({ + }), + { + }, ]) def test_get_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -5079,7 +5109,7 @@ def test_get_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5139,9 +5169,10 @@ def test_get_sink_non_empty_request_with_auto_populated_field(): client.get_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSinkRequest( + request_msg = logging_config.GetSinkRequest( sink_name='sink_name_value', ) + assert args[0] == request_msg def test_get_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5210,7 +5241,11 @@ async def test_get_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetSinkRequest({ }), + { }, +]) +async def test_get_sink_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5218,7 +5253,7 @@ async def test_get_sink_async(transport: str = 'grpc_asyncio', request_type=logg # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5254,11 +5289,6 @@ async def test_get_sink_async(transport: str = 'grpc_asyncio', request_type=logg assert response.writer_identity == 'writer_identity_value' assert response.include_children is True - -@pytest.mark.asyncio -async def test_get_sink_async_from_dict(): - await test_get_sink_async(request_type=dict) - def test_get_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5405,8 +5435,10 @@ async def test_get_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateSinkRequest, - dict, + logging_config.CreateSinkRequest({ + }), + { + }, ]) def test_create_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -5416,7 +5448,7 @@ def test_create_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5476,9 +5508,10 @@ def test_create_sink_non_empty_request_with_auto_populated_field(): client.create_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateSinkRequest( + request_msg = logging_config.CreateSinkRequest( parent='parent_value', ) + assert args[0] == request_msg def test_create_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5547,7 +5580,11 @@ async def test_create_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateSinkRequest({ }), + { }, +]) +async def test_create_sink_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5555,7 +5592,7 @@ async def test_create_sink_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5591,11 +5628,6 @@ async def test_create_sink_async(transport: str = 'grpc_asyncio', request_type=l assert response.writer_identity == 'writer_identity_value' assert response.include_children is True - -@pytest.mark.asyncio -async def test_create_sink_async_from_dict(): - await test_create_sink_async(request_type=dict) - def test_create_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5752,8 +5784,10 @@ async def test_create_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSinkRequest, - dict, + logging_config.UpdateSinkRequest({ + }), + { + }, ]) def test_update_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -5763,7 +5797,7 @@ def test_update_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5823,9 +5857,10 @@ def test_update_sink_non_empty_request_with_auto_populated_field(): client.update_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSinkRequest( + request_msg = logging_config.UpdateSinkRequest( sink_name='sink_name_value', ) + assert args[0] == request_msg def test_update_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5894,7 +5929,11 @@ async def test_update_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateSinkRequest({ }), + { }, +]) +async def test_update_sink_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5902,7 +5941,7 @@ async def test_update_sink_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5938,11 +5977,6 @@ async def test_update_sink_async(transport: str = 'grpc_asyncio', request_type=l assert response.writer_identity == 'writer_identity_value' assert response.include_children is True - -@pytest.mark.asyncio -async def test_update_sink_async_from_dict(): - await test_update_sink_async(request_type=dict) - def test_update_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6109,8 +6143,10 @@ async def test_update_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteSinkRequest, - dict, + logging_config.DeleteSinkRequest({ + }), + { + }, ]) def test_delete_sink(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -6120,7 +6156,7 @@ def test_delete_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6163,9 +6199,10 @@ def test_delete_sink_non_empty_request_with_auto_populated_field(): client.delete_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteSinkRequest( + request_msg = logging_config.DeleteSinkRequest( sink_name='sink_name_value', ) + assert args[0] == request_msg def test_delete_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6234,7 +6271,11 @@ async def test_delete_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteSinkRequest({ }), + { }, +]) +async def test_delete_sink_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6242,7 +6283,7 @@ async def test_delete_sink_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6261,11 +6302,6 @@ async def test_delete_sink_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_sink_async_from_dict(): - await test_delete_sink_async(request_type=dict) - def test_delete_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6412,8 +6448,10 @@ async def test_delete_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateLinkRequest, - dict, + logging_config.CreateLinkRequest({ + }), + { + }, ]) def test_create_link(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -6423,7 +6461,7 @@ def test_create_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6467,10 +6505,11 @@ def test_create_link_non_empty_request_with_auto_populated_field(): client.create_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateLinkRequest( + request_msg = logging_config.CreateLinkRequest( parent='parent_value', link_id='link_id_value', ) + assert args[0] == request_msg def test_create_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6549,7 +6588,11 @@ async def test_create_link_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateLinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateLinkRequest({ }), + { }, +]) +async def test_create_link_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6557,7 +6600,7 @@ async def test_create_link_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6578,11 +6621,6 @@ async def test_create_link_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_link_async_from_dict(): - await test_create_link_async(request_type=dict) - def test_create_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6751,8 +6789,10 @@ async def test_create_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteLinkRequest, - dict, + logging_config.DeleteLinkRequest({ + }), + { + }, ]) def test_delete_link(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -6762,7 +6802,7 @@ def test_delete_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6805,9 +6845,10 @@ def test_delete_link_non_empty_request_with_auto_populated_field(): client.delete_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteLinkRequest( + request_msg = logging_config.DeleteLinkRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6886,7 +6927,11 @@ async def test_delete_link_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteLinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteLinkRequest({ }), + { }, +]) +async def test_delete_link_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6894,7 +6939,7 @@ async def test_delete_link_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6915,11 +6960,6 @@ async def test_delete_link_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_link_async_from_dict(): - await test_delete_link_async(request_type=dict) - def test_delete_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7068,8 +7108,10 @@ async def test_delete_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListLinksRequest, - dict, + logging_config.ListLinksRequest({ + }), + { + }, ]) def test_list_links(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -7079,7 +7121,7 @@ def test_list_links(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7126,10 +7168,11 @@ def test_list_links_non_empty_request_with_auto_populated_field(): client.list_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListLinksRequest( + request_msg = logging_config.ListLinksRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_links_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7198,7 +7241,11 @@ async def test_list_links_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_links_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListLinksRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListLinksRequest({ }), + { }, +]) +async def test_list_links_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7206,7 +7253,7 @@ async def test_list_links_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7228,11 +7275,6 @@ async def test_list_links_async(transport: str = 'grpc_asyncio', request_type=lo assert isinstance(response, pagers.ListLinksAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_links_async_from_dict(): - await test_list_links_async(request_type=dict) - def test_list_links_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7573,8 +7615,10 @@ async def test_list_links_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetLinkRequest, - dict, + logging_config.GetLinkRequest({ + }), + { + }, ]) def test_get_link(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -7584,7 +7628,7 @@ def test_get_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7634,9 +7678,10 @@ def test_get_link_non_empty_request_with_auto_populated_field(): client.get_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetLinkRequest( + request_msg = logging_config.GetLinkRequest( name='name_value', ) + assert args[0] == request_msg def test_get_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7705,7 +7750,11 @@ async def test_get_link_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetLinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetLinkRequest({ }), + { }, +]) +async def test_get_link_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7713,7 +7762,7 @@ async def test_get_link_async(transport: str = 'grpc_asyncio', request_type=logg # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7739,11 +7788,6 @@ async def test_get_link_async(transport: str = 'grpc_asyncio', request_type=logg assert response.description == 'description_value' assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE - -@pytest.mark.asyncio -async def test_get_link_async_from_dict(): - await test_get_link_async(request_type=dict) - def test_get_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7890,8 +7934,10 @@ async def test_get_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListExclusionsRequest, - dict, + logging_config.ListExclusionsRequest({ + }), + { + }, ]) def test_list_exclusions(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -7901,7 +7947,7 @@ def test_list_exclusions(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7948,10 +7994,11 @@ def test_list_exclusions_non_empty_request_with_auto_populated_field(): client.list_exclusions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListExclusionsRequest( + request_msg = logging_config.ListExclusionsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_exclusions_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8020,7 +8067,11 @@ async def test_list_exclusions_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_exclusions_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListExclusionsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListExclusionsRequest({ }), + { }, +]) +async def test_list_exclusions_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8028,7 +8079,7 @@ async def test_list_exclusions_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8050,11 +8101,6 @@ async def test_list_exclusions_async(transport: str = 'grpc_asyncio', request_ty assert isinstance(response, pagers.ListExclusionsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_exclusions_async_from_dict(): - await test_list_exclusions_async(request_type=dict) - def test_list_exclusions_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8395,8 +8441,10 @@ async def test_list_exclusions_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetExclusionRequest, - dict, + logging_config.GetExclusionRequest({ + }), + { + }, ]) def test_get_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -8406,7 +8454,7 @@ def test_get_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8458,9 +8506,10 @@ def test_get_exclusion_non_empty_request_with_auto_populated_field(): client.get_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetExclusionRequest( + request_msg = logging_config.GetExclusionRequest( name='name_value', ) + assert args[0] == request_msg def test_get_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8529,7 +8578,11 @@ async def test_get_exclusion_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetExclusionRequest({ }), + { }, +]) +async def test_get_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8537,7 +8590,7 @@ async def test_get_exclusion_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8565,11 +8618,6 @@ async def test_get_exclusion_async(transport: str = 'grpc_asyncio', request_type assert response.filter == 'filter_value' assert response.disabled is True - -@pytest.mark.asyncio -async def test_get_exclusion_async_from_dict(): - await test_get_exclusion_async(request_type=dict) - def test_get_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8716,8 +8764,10 @@ async def test_get_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateExclusionRequest, - dict, + logging_config.CreateExclusionRequest({ + }), + { + }, ]) def test_create_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -8727,7 +8777,7 @@ def test_create_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8779,9 +8829,10 @@ def test_create_exclusion_non_empty_request_with_auto_populated_field(): client.create_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateExclusionRequest( + request_msg = logging_config.CreateExclusionRequest( parent='parent_value', ) + assert args[0] == request_msg def test_create_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8850,7 +8901,11 @@ async def test_create_exclusion_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateExclusionRequest({ }), + { }, +]) +async def test_create_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8858,7 +8913,7 @@ async def test_create_exclusion_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8886,11 +8941,6 @@ async def test_create_exclusion_async(transport: str = 'grpc_asyncio', request_t assert response.filter == 'filter_value' assert response.disabled is True - -@pytest.mark.asyncio -async def test_create_exclusion_async_from_dict(): - await test_create_exclusion_async(request_type=dict) - def test_create_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9047,8 +9097,10 @@ async def test_create_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateExclusionRequest, - dict, + logging_config.UpdateExclusionRequest({ + }), + { + }, ]) def test_update_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9058,7 +9110,7 @@ def test_update_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9110,9 +9162,10 @@ def test_update_exclusion_non_empty_request_with_auto_populated_field(): client.update_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateExclusionRequest( + request_msg = logging_config.UpdateExclusionRequest( name='name_value', ) + assert args[0] == request_msg def test_update_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9181,7 +9234,11 @@ async def test_update_exclusion_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateExclusionRequest({ }), + { }, +]) +async def test_update_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9189,7 +9246,7 @@ async def test_update_exclusion_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9217,11 +9274,6 @@ async def test_update_exclusion_async(transport: str = 'grpc_asyncio', request_t assert response.filter == 'filter_value' assert response.disabled is True - -@pytest.mark.asyncio -async def test_update_exclusion_async_from_dict(): - await test_update_exclusion_async(request_type=dict) - def test_update_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9388,8 +9440,10 @@ async def test_update_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteExclusionRequest, - dict, + logging_config.DeleteExclusionRequest({ + }), + { + }, ]) def test_delete_exclusion(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9399,7 +9453,7 @@ def test_delete_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9442,9 +9496,10 @@ def test_delete_exclusion_non_empty_request_with_auto_populated_field(): client.delete_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteExclusionRequest( + request_msg = logging_config.DeleteExclusionRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9513,7 +9568,11 @@ async def test_delete_exclusion_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteExclusionRequest({ }), + { }, +]) +async def test_delete_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9521,7 +9580,7 @@ async def test_delete_exclusion_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9540,11 +9599,6 @@ async def test_delete_exclusion_async(transport: str = 'grpc_asyncio', request_t # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_exclusion_async_from_dict(): - await test_delete_exclusion_async(request_type=dict) - def test_delete_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9691,8 +9745,10 @@ async def test_delete_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetCmekSettingsRequest, - dict, + logging_config.GetCmekSettingsRequest({ + }), + { + }, ]) def test_get_cmek_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9702,7 +9758,7 @@ def test_get_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9754,9 +9810,10 @@ def test_get_cmek_settings_non_empty_request_with_auto_populated_field(): client.get_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetCmekSettingsRequest( + request_msg = logging_config.GetCmekSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test_get_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9825,7 +9882,11 @@ async def test_get_cmek_settings_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetCmekSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetCmekSettingsRequest({ }), + { }, +]) +async def test_get_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9833,7 +9894,7 @@ async def test_get_cmek_settings_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9861,11 +9922,6 @@ async def test_get_cmek_settings_async(transport: str = 'grpc_asyncio', request_ assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' - -@pytest.mark.asyncio -async def test_get_cmek_settings_async_from_dict(): - await test_get_cmek_settings_async(request_type=dict) - def test_get_cmek_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9930,8 +9986,10 @@ async def test_get_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateCmekSettingsRequest, - dict, + logging_config.UpdateCmekSettingsRequest({ + }), + { + }, ]) def test_update_cmek_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -9941,7 +9999,7 @@ def test_update_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9993,9 +10051,10 @@ def test_update_cmek_settings_non_empty_request_with_auto_populated_field(): client.update_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateCmekSettingsRequest( + request_msg = logging_config.UpdateCmekSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test_update_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10064,7 +10123,11 @@ async def test_update_cmek_settings_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateCmekSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateCmekSettingsRequest({ }), + { }, +]) +async def test_update_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10072,7 +10135,7 @@ async def test_update_cmek_settings_async(transport: str = 'grpc_asyncio', reque # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10100,11 +10163,6 @@ async def test_update_cmek_settings_async(transport: str = 'grpc_asyncio', reque assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' - -@pytest.mark.asyncio -async def test_update_cmek_settings_async_from_dict(): - await test_update_cmek_settings_async(request_type=dict) - def test_update_cmek_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10169,8 +10227,10 @@ async def test_update_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetSettingsRequest, - dict, + logging_config.GetSettingsRequest({ + }), + { + }, ]) def test_get_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -10180,7 +10240,7 @@ def test_get_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10234,9 +10294,10 @@ def test_get_settings_non_empty_request_with_auto_populated_field(): client.get_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSettingsRequest( + request_msg = logging_config.GetSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test_get_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10305,7 +10366,11 @@ async def test_get_settings_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetSettingsRequest({ }), + { }, +]) +async def test_get_settings_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10313,7 +10378,7 @@ async def test_get_settings_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10343,11 +10408,6 @@ async def test_get_settings_async(transport: str = 'grpc_asyncio', request_type= assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True - -@pytest.mark.asyncio -async def test_get_settings_async_from_dict(): - await test_get_settings_async(request_type=dict) - def test_get_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10494,8 +10554,10 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSettingsRequest, - dict, + logging_config.UpdateSettingsRequest({ + }), + { + }, ]) def test_update_settings(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -10505,7 +10567,7 @@ def test_update_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10559,9 +10621,10 @@ def test_update_settings_non_empty_request_with_auto_populated_field(): client.update_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSettingsRequest( + request_msg = logging_config.UpdateSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test_update_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10630,7 +10693,11 @@ async def test_update_settings_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateSettingsRequest({ }), + { }, +]) +async def test_update_settings_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10638,7 +10705,7 @@ async def test_update_settings_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10668,11 +10735,6 @@ async def test_update_settings_async(transport: str = 'grpc_asyncio', request_ty assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True - -@pytest.mark.asyncio -async def test_update_settings_async_from_dict(): - await test_update_settings_async(request_type=dict) - def test_update_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10829,8 +10891,10 @@ async def test_update_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CopyLogEntriesRequest, - dict, + logging_config.CopyLogEntriesRequest({ + }), + { + }, ]) def test_copy_log_entries(request_type, transport: str = 'grpc'): client = ConfigServiceV2Client( @@ -10840,7 +10904,7 @@ def test_copy_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10885,11 +10949,12 @@ def test_copy_log_entries_non_empty_request_with_auto_populated_field(): client.copy_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CopyLogEntriesRequest( + request_msg = logging_config.CopyLogEntriesRequest( name='name_value', filter='filter_value', destination='destination_value', ) + assert args[0] == request_msg def test_copy_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10968,7 +11033,11 @@ async def test_copy_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_copy_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging_config.CopyLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CopyLogEntriesRequest({ }), + { }, +]) +async def test_copy_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10976,7 +11045,7 @@ async def test_copy_log_entries_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10998,11 +11067,6 @@ async def test_copy_log_entries_async(transport: str = 'grpc_asyncio', request_t assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_copy_log_entries_async_from_dict(): - await test_copy_log_entries_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ConfigServiceV2GrpcTransport( @@ -11123,7 +11187,6 @@ def test_list_buckets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() - assert args[0] == request_msg @@ -11146,7 +11209,6 @@ def test_get_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() - assert args[0] == request_msg @@ -11169,7 +11231,6 @@ def test_create_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11192,7 +11253,6 @@ def test_update_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -11215,7 +11275,6 @@ def test_create_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11238,7 +11297,6 @@ def test_update_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -11261,7 +11319,6 @@ def test_delete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() - assert args[0] == request_msg @@ -11284,7 +11341,6 @@ def test_undelete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() - assert args[0] == request_msg @@ -11307,7 +11363,6 @@ def test_list_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() - assert args[0] == request_msg @@ -11330,7 +11385,6 @@ def test_get_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() - assert args[0] == request_msg @@ -11353,7 +11407,6 @@ def test_create_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() - assert args[0] == request_msg @@ -11376,7 +11429,6 @@ def test_update_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() - assert args[0] == request_msg @@ -11399,7 +11451,6 @@ def test_delete_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() - assert args[0] == request_msg @@ -11422,7 +11473,6 @@ def test_list_sinks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() - assert args[0] == request_msg @@ -11445,7 +11495,6 @@ def test_get_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() - assert args[0] == request_msg @@ -11468,7 +11517,6 @@ def test_create_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() - assert args[0] == request_msg @@ -11491,7 +11539,6 @@ def test_update_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() - assert args[0] == request_msg @@ -11514,7 +11561,6 @@ def test_delete_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() - assert args[0] == request_msg @@ -11537,7 +11583,6 @@ def test_create_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() - assert args[0] == request_msg @@ -11560,7 +11605,6 @@ def test_delete_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() - assert args[0] == request_msg @@ -11583,7 +11627,6 @@ def test_list_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() - assert args[0] == request_msg @@ -11606,7 +11649,6 @@ def test_get_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() - assert args[0] == request_msg @@ -11629,7 +11671,6 @@ def test_list_exclusions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() - assert args[0] == request_msg @@ -11652,7 +11693,6 @@ def test_get_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() - assert args[0] == request_msg @@ -11675,7 +11715,6 @@ def test_create_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() - assert args[0] == request_msg @@ -11698,7 +11737,6 @@ def test_update_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() - assert args[0] == request_msg @@ -11721,7 +11759,6 @@ def test_delete_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() - assert args[0] == request_msg @@ -11744,7 +11781,6 @@ def test_get_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() - assert args[0] == request_msg @@ -11767,7 +11803,6 @@ def test_update_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() - assert args[0] == request_msg @@ -11790,7 +11825,6 @@ def test_get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() - assert args[0] == request_msg @@ -11813,7 +11847,6 @@ def test_update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() - assert args[0] == request_msg @@ -11836,7 +11869,6 @@ def test_copy_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() - assert args[0] == request_msg @@ -11878,7 +11910,6 @@ async def test_list_buckets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() - assert args[0] == request_msg @@ -11911,7 +11942,6 @@ async def test_get_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() - assert args[0] == request_msg @@ -11938,7 +11968,6 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11965,7 +11994,6 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -11998,7 +12026,6 @@ async def test_create_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -12031,7 +12058,6 @@ async def test_update_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -12056,7 +12082,6 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() - assert args[0] == request_msg @@ -12081,7 +12106,6 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() - assert args[0] == request_msg @@ -12108,7 +12132,6 @@ async def test_list_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() - assert args[0] == request_msg @@ -12137,7 +12160,6 @@ async def test_get_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() - assert args[0] == request_msg @@ -12166,7 +12188,6 @@ async def test_create_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() - assert args[0] == request_msg @@ -12195,7 +12216,6 @@ async def test_update_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() - assert args[0] == request_msg @@ -12220,7 +12240,6 @@ async def test_delete_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() - assert args[0] == request_msg @@ -12247,7 +12266,6 @@ async def test_list_sinks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() - assert args[0] == request_msg @@ -12281,7 +12299,6 @@ async def test_get_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() - assert args[0] == request_msg @@ -12315,7 +12332,6 @@ async def test_create_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() - assert args[0] == request_msg @@ -12349,7 +12365,6 @@ async def test_update_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() - assert args[0] == request_msg @@ -12374,7 +12389,6 @@ async def test_delete_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() - assert args[0] == request_msg @@ -12401,7 +12415,6 @@ async def test_create_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() - assert args[0] == request_msg @@ -12428,7 +12441,6 @@ async def test_delete_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() - assert args[0] == request_msg @@ -12455,7 +12467,6 @@ async def test_list_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() - assert args[0] == request_msg @@ -12484,7 +12495,6 @@ async def test_get_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() - assert args[0] == request_msg @@ -12511,7 +12521,6 @@ async def test_list_exclusions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() - assert args[0] == request_msg @@ -12541,7 +12550,6 @@ async def test_get_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() - assert args[0] == request_msg @@ -12571,7 +12579,6 @@ async def test_create_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() - assert args[0] == request_msg @@ -12601,7 +12608,6 @@ async def test_update_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() - assert args[0] == request_msg @@ -12626,7 +12632,6 @@ async def test_delete_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() - assert args[0] == request_msg @@ -12656,7 +12661,6 @@ async def test_get_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() - assert args[0] == request_msg @@ -12686,7 +12690,6 @@ async def test_update_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() - assert args[0] == request_msg @@ -12717,7 +12720,6 @@ async def test_get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() - assert args[0] == request_msg @@ -12748,7 +12750,6 @@ async def test_update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() - assert args[0] == request_msg @@ -12775,7 +12776,6 @@ async def test_copy_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index c843e973f7ca..d17295af4442 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -962,8 +962,10 @@ def test_logging_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging.DeleteLogRequest, - dict, + logging.DeleteLogRequest({ + }), + { + }, ]) def test_delete_log(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -973,7 +975,7 @@ def test_delete_log(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1016,9 +1018,10 @@ def test_delete_log_non_empty_request_with_auto_populated_field(): client.delete_log(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.DeleteLogRequest( + request_msg = logging.DeleteLogRequest( log_name='log_name_value', ) + assert args[0] == request_msg def test_delete_log_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1087,7 +1090,11 @@ async def test_delete_log_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=logging.DeleteLogRequest): +@pytest.mark.parametrize("request_type", [ + logging.DeleteLogRequest({ }), + { }, +]) +async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1095,7 +1102,7 @@ async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1114,11 +1121,6 @@ async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_log_async_from_dict(): - await test_delete_log_async(request_type=dict) - def test_delete_log_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1265,8 +1267,10 @@ async def test_delete_log_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.WriteLogEntriesRequest, - dict, + logging.WriteLogEntriesRequest({ + }), + { + }, ]) def test_write_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1276,7 +1280,7 @@ def test_write_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1320,9 +1324,10 @@ def test_write_log_entries_non_empty_request_with_auto_populated_field(): client.write_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.WriteLogEntriesRequest( + request_msg = logging.WriteLogEntriesRequest( log_name='log_name_value', ) + assert args[0] == request_msg def test_write_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1391,7 +1396,11 @@ async def test_write_log_entries_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.WriteLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging.WriteLogEntriesRequest({ }), + { }, +]) +async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1399,7 +1408,7 @@ async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1420,11 +1429,6 @@ async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_ assert isinstance(response, logging.WriteLogEntriesResponse) -@pytest.mark.asyncio -async def test_write_log_entries_async_from_dict(): - await test_write_log_entries_async(request_type=dict) - - def test_write_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1538,8 +1542,10 @@ async def test_write_log_entries_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.ListLogEntriesRequest, - dict, + logging.ListLogEntriesRequest({ + }), + { + }, ]) def test_list_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1549,7 +1555,7 @@ def test_list_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1597,11 +1603,12 @@ def test_list_log_entries_non_empty_request_with_auto_populated_field(): client.list_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogEntriesRequest( + request_msg = logging.ListLogEntriesRequest( filter='filter_value', order_by='order_by_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1670,7 +1677,11 @@ async def test_list_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging.ListLogEntriesRequest({ }), + { }, +]) +async def test_list_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1678,7 +1689,7 @@ async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1701,11 +1712,6 @@ async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_t assert response.next_page_token == 'next_page_token_value' -@pytest.mark.asyncio -async def test_list_log_entries_async_from_dict(): - await test_list_log_entries_async(request_type=dict) - - def test_list_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1998,8 +2004,10 @@ async def test_list_log_entries_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListMonitoredResourceDescriptorsRequest, - dict, + logging.ListMonitoredResourceDescriptorsRequest({ + }), + { + }, ]) def test_list_monitored_resource_descriptors(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2009,7 +2017,7 @@ def test_list_monitored_resource_descriptors(request_type, transport: str = 'grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2055,9 +2063,10 @@ def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populat client.list_monitored_resource_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListMonitoredResourceDescriptorsRequest( + request_msg = logging.ListMonitoredResourceDescriptorsRequest( page_token='page_token_value', ) + assert args[0] == request_msg def test_list_monitored_resource_descriptors_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2126,7 +2135,11 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_asyncio', request_type=logging.ListMonitoredResourceDescriptorsRequest): +@pytest.mark.parametrize("request_type", [ + logging.ListMonitoredResourceDescriptorsRequest({ }), + { }, +]) +async def test_list_monitored_resource_descriptors_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2134,7 +2147,7 @@ async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2157,11 +2170,6 @@ async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_ assert response.next_page_token == 'next_page_token_value' -@pytest.mark.asyncio -async def test_list_monitored_resource_descriptors_async_from_dict(): - await test_list_monitored_resource_descriptors_async(request_type=dict) - - def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc"): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2352,8 +2360,10 @@ async def test_list_monitored_resource_descriptors_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListLogsRequest, - dict, + logging.ListLogsRequest({ + }), + { + }, ]) def test_list_logs(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2363,7 +2373,7 @@ def test_list_logs(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2412,10 +2422,11 @@ def test_list_logs_non_empty_request_with_auto_populated_field(): client.list_logs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogsRequest( + request_msg = logging.ListLogsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_logs_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2484,7 +2495,11 @@ async def test_list_logs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogsRequest): +@pytest.mark.parametrize("request_type", [ + logging.ListLogsRequest({ }), + { }, +]) +async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2492,7 +2507,7 @@ async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=log # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2516,11 +2531,6 @@ async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=log assert response.log_names == ['log_names_value'] assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_logs_async_from_dict(): - await test_list_logs_async(request_type=dict) - def test_list_logs_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2861,8 +2871,10 @@ async def test_list_logs_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.TailLogEntriesRequest, - dict, + logging.TailLogEntriesRequest({ + }), + { + }, ]) def test_tail_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2872,7 +2884,7 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2892,7 +2904,6 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): for message in response: assert isinstance(message, logging.TailLogEntriesResponse) - def test_tail_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2960,7 +2971,11 @@ async def test_tail_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.TailLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging.TailLogEntriesRequest({ }), + { }, +]) +async def test_tail_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2968,7 +2983,7 @@ async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2990,11 +3005,6 @@ async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_t assert isinstance(message, logging.TailLogEntriesResponse) -@pytest.mark.asyncio -async def test_tail_log_entries_async_from_dict(): - await test_tail_log_entries_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LoggingServiceV2GrpcTransport( @@ -3115,7 +3125,6 @@ def test_delete_log_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() - assert args[0] == request_msg @@ -3138,7 +3147,6 @@ def test_write_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() - assert args[0] == request_msg @@ -3161,7 +3169,6 @@ def test_list_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() - assert args[0] == request_msg @@ -3184,7 +3191,6 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -3207,7 +3213,6 @@ def test_list_logs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() - assert args[0] == request_msg @@ -3247,7 +3252,6 @@ async def test_delete_log_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() - assert args[0] == request_msg @@ -3273,7 +3277,6 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() - assert args[0] == request_msg @@ -3300,7 +3303,6 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() - assert args[0] == request_msg @@ -3327,7 +3329,6 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -3355,7 +3356,6 @@ async def test_list_logs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 9e71b7a02eb6..44f71aaf1ecc 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -960,8 +960,10 @@ def test_metrics_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging_metrics.ListLogMetricsRequest, - dict, + logging_metrics.ListLogMetricsRequest({ + }), + { + }, ]) def test_list_log_metrics(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -971,7 +973,7 @@ def test_list_log_metrics(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1018,10 +1020,11 @@ def test_list_log_metrics_non_empty_request_with_auto_populated_field(): client.list_log_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.ListLogMetricsRequest( + request_msg = logging_metrics.ListLogMetricsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_log_metrics_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1090,7 +1093,11 @@ async def test_list_log_metrics_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_log_metrics_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.ListLogMetricsRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.ListLogMetricsRequest({ }), + { }, +]) +async def test_list_log_metrics_async(request_type, transport: str = 'grpc_asyncio'): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1098,7 +1105,7 @@ async def test_list_log_metrics_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1120,11 +1127,6 @@ async def test_list_log_metrics_async(transport: str = 'grpc_asyncio', request_t assert isinstance(response, pagers.ListLogMetricsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_log_metrics_async_from_dict(): - await test_list_log_metrics_async(request_type=dict) - def test_list_log_metrics_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1465,8 +1467,10 @@ async def test_list_log_metrics_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_metrics.GetLogMetricRequest, - dict, + logging_metrics.GetLogMetricRequest({ + }), + { + }, ]) def test_get_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -1476,7 +1480,7 @@ def test_get_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1534,9 +1538,10 @@ def test_get_log_metric_non_empty_request_with_auto_populated_field(): client.get_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.GetLogMetricRequest( + request_msg = logging_metrics.GetLogMetricRequest( metric_name='metric_name_value', ) + assert args[0] == request_msg def test_get_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1605,7 +1610,11 @@ async def test_get_log_metric_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.GetLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.GetLogMetricRequest({ }), + { }, +]) +async def test_get_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1613,7 +1622,7 @@ async def test_get_log_metric_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1647,11 +1656,6 @@ async def test_get_log_metric_async(transport: str = 'grpc_asyncio', request_typ assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 - -@pytest.mark.asyncio -async def test_get_log_metric_async_from_dict(): - await test_get_log_metric_async(request_type=dict) - def test_get_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1798,8 +1802,10 @@ async def test_get_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.CreateLogMetricRequest, - dict, + logging_metrics.CreateLogMetricRequest({ + }), + { + }, ]) def test_create_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -1809,7 +1815,7 @@ def test_create_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1867,9 +1873,10 @@ def test_create_log_metric_non_empty_request_with_auto_populated_field(): client.create_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.CreateLogMetricRequest( + request_msg = logging_metrics.CreateLogMetricRequest( parent='parent_value', ) + assert args[0] == request_msg def test_create_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1938,7 +1945,11 @@ async def test_create_log_metric_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.CreateLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.CreateLogMetricRequest({ }), + { }, +]) +async def test_create_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1946,7 +1957,7 @@ async def test_create_log_metric_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1980,11 +1991,6 @@ async def test_create_log_metric_async(transport: str = 'grpc_asyncio', request_ assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 - -@pytest.mark.asyncio -async def test_create_log_metric_async_from_dict(): - await test_create_log_metric_async(request_type=dict) - def test_create_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2141,8 +2147,10 @@ async def test_create_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.UpdateLogMetricRequest, - dict, + logging_metrics.UpdateLogMetricRequest({ + }), + { + }, ]) def test_update_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -2152,7 +2160,7 @@ def test_update_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2210,9 +2218,10 @@ def test_update_log_metric_non_empty_request_with_auto_populated_field(): client.update_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.UpdateLogMetricRequest( + request_msg = logging_metrics.UpdateLogMetricRequest( metric_name='metric_name_value', ) + assert args[0] == request_msg def test_update_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2281,7 +2290,11 @@ async def test_update_log_metric_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.UpdateLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.UpdateLogMetricRequest({ }), + { }, +]) +async def test_update_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2289,7 +2302,7 @@ async def test_update_log_metric_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2323,11 +2336,6 @@ async def test_update_log_metric_async(transport: str = 'grpc_asyncio', request_ assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 - -@pytest.mark.asyncio -async def test_update_log_metric_async_from_dict(): - await test_update_log_metric_async(request_type=dict) - def test_update_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2484,8 +2492,10 @@ async def test_update_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.DeleteLogMetricRequest, - dict, + logging_metrics.DeleteLogMetricRequest({ + }), + { + }, ]) def test_delete_log_metric(request_type, transport: str = 'grpc'): client = MetricsServiceV2Client( @@ -2495,7 +2505,7 @@ def test_delete_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2538,9 +2548,10 @@ def test_delete_log_metric_non_empty_request_with_auto_populated_field(): client.delete_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.DeleteLogMetricRequest( + request_msg = logging_metrics.DeleteLogMetricRequest( metric_name='metric_name_value', ) + assert args[0] == request_msg def test_delete_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2609,7 +2620,11 @@ async def test_delete_log_metric_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.DeleteLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.DeleteLogMetricRequest({ }), + { }, +]) +async def test_delete_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2617,7 +2632,7 @@ async def test_delete_log_metric_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2636,11 +2651,6 @@ async def test_delete_log_metric_async(transport: str = 'grpc_asyncio', request_ # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_log_metric_async_from_dict(): - await test_delete_log_metric_async(request_type=dict) - def test_delete_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2906,7 +2916,6 @@ def test_list_log_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() - assert args[0] == request_msg @@ -2929,7 +2938,6 @@ def test_get_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() - assert args[0] == request_msg @@ -2952,7 +2960,6 @@ def test_create_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() - assert args[0] == request_msg @@ -2975,7 +2982,6 @@ def test_update_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() - assert args[0] == request_msg @@ -2998,7 +3004,6 @@ def test_delete_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() - assert args[0] == request_msg @@ -3040,7 +3045,6 @@ async def test_list_log_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() - assert args[0] == request_msg @@ -3073,7 +3077,6 @@ async def test_get_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() - assert args[0] == request_msg @@ -3106,7 +3109,6 @@ async def test_create_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() - assert args[0] == request_msg @@ -3139,7 +3141,6 @@ async def test_update_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() - assert args[0] == request_msg @@ -3164,7 +3165,6 @@ async def test_delete_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py index cbaedc317904..6d3e18c4acdc 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -960,8 +960,10 @@ def test_base_config_service_v2_client_create_channel_credentials_file(client_cl @pytest.mark.parametrize("request_type", [ - logging_config.ListBucketsRequest, - dict, + logging_config.ListBucketsRequest({ + }), + { + }, ]) def test_list_buckets(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -971,7 +973,7 @@ def test_list_buckets(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1018,10 +1020,11 @@ def test_list_buckets_non_empty_request_with_auto_populated_field(): client.list_buckets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListBucketsRequest( + request_msg = logging_config.ListBucketsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_buckets_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1090,7 +1093,11 @@ async def test_list_buckets_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListBucketsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListBucketsRequest({ }), + { }, +]) +async def test_list_buckets_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1098,7 +1105,7 @@ async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1120,11 +1127,6 @@ async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type= assert isinstance(response, pagers.ListBucketsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_buckets_async_from_dict(): - await test_list_buckets_async(request_type=dict) - def test_list_buckets_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1465,8 +1467,10 @@ async def test_list_buckets_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetBucketRequest, - dict, + logging_config.GetBucketRequest({ + }), + { + }, ]) def test_get_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -1476,7 +1480,7 @@ def test_get_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1534,9 +1538,10 @@ def test_get_bucket_non_empty_request_with_auto_populated_field(): client.get_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetBucketRequest( + request_msg = logging_config.GetBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_get_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1605,7 +1610,11 @@ async def test_get_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetBucketRequest({ }), + { }, +]) +async def test_get_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1613,7 +1622,7 @@ async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1647,11 +1656,6 @@ async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=lo assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] - -@pytest.mark.asyncio -async def test_get_bucket_async_from_dict(): - await test_get_bucket_async(request_type=dict) - def test_get_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1716,8 +1720,10 @@ async def test_get_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest, - dict, + logging_config.CreateBucketRequest({ + }), + { + }, ]) def test_create_bucket_async(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -1727,7 +1733,7 @@ def test_create_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1771,10 +1777,11 @@ def test_create_bucket_async_non_empty_request_with_auto_populated_field(): client.create_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest( + request_msg = logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) + assert args[0] == request_msg def test_create_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1853,7 +1860,11 @@ async def test_create_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateBucketRequest({ }), + { }, +]) +async def test_create_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1861,7 +1872,7 @@ async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', reques # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1882,11 +1893,6 @@ async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', reques # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_bucket_async_async_from_dict(): - await test_create_bucket_async_async(request_type=dict) - def test_create_bucket_async_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1951,8 +1957,10 @@ async def test_create_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest, - dict, + logging_config.UpdateBucketRequest({ + }), + { + }, ]) def test_update_bucket_async(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -1962,7 +1970,7 @@ def test_update_bucket_async(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2005,9 +2013,10 @@ def test_update_bucket_async_non_empty_request_with_auto_populated_field(): client.update_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest( + request_msg = logging_config.UpdateBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_update_bucket_async_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2086,7 +2095,11 @@ async def test_update_bucket_async_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateBucketRequest({ }), + { }, +]) +async def test_update_bucket_async_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2094,7 +2107,7 @@ async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', reques # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2115,11 +2128,6 @@ async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', reques # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_bucket_async_async_from_dict(): - await test_update_bucket_async_async(request_type=dict) - def test_update_bucket_async_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2184,8 +2192,10 @@ async def test_update_bucket_async_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateBucketRequest, - dict, + logging_config.CreateBucketRequest({ + }), + { + }, ]) def test_create_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2195,7 +2205,7 @@ def test_create_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2254,10 +2264,11 @@ def test_create_bucket_non_empty_request_with_auto_populated_field(): client.create_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest( + request_msg = logging_config.CreateBucketRequest( parent='parent_value', bucket_id='bucket_id_value', ) + assert args[0] == request_msg def test_create_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2326,7 +2337,11 @@ async def test_create_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateBucketRequest({ }), + { }, +]) +async def test_create_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2334,7 +2349,7 @@ async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2368,11 +2383,6 @@ async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] - -@pytest.mark.asyncio -async def test_create_bucket_async_from_dict(): - await test_create_bucket_async(request_type=dict) - def test_create_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2437,8 +2447,10 @@ async def test_create_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateBucketRequest, - dict, + logging_config.UpdateBucketRequest({ + }), + { + }, ]) def test_update_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2448,7 +2460,7 @@ def test_update_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2506,9 +2518,10 @@ def test_update_bucket_non_empty_request_with_auto_populated_field(): client.update_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest( + request_msg = logging_config.UpdateBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_update_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2577,7 +2590,11 @@ async def test_update_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateBucketRequest({ }), + { }, +]) +async def test_update_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2585,7 +2602,7 @@ async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2619,11 +2636,6 @@ async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type assert response.analytics_enabled is True assert response.restricted_fields == ['restricted_fields_value'] - -@pytest.mark.asyncio -async def test_update_bucket_async_from_dict(): - await test_update_bucket_async(request_type=dict) - def test_update_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,8 +2700,10 @@ async def test_update_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteBucketRequest, - dict, + logging_config.DeleteBucketRequest({ + }), + { + }, ]) def test_delete_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2699,7 +2713,7 @@ def test_delete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2742,9 +2756,10 @@ def test_delete_bucket_non_empty_request_with_auto_populated_field(): client.delete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteBucketRequest( + request_msg = logging_config.DeleteBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2813,7 +2828,11 @@ async def test_delete_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteBucketRequest({ }), + { }, +]) +async def test_delete_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2821,7 +2840,7 @@ async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2840,11 +2859,6 @@ async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_bucket_async_from_dict(): - await test_delete_bucket_async(request_type=dict) - def test_delete_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2909,8 +2923,10 @@ async def test_delete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UndeleteBucketRequest, - dict, + logging_config.UndeleteBucketRequest({ + }), + { + }, ]) def test_undelete_bucket(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -2920,7 +2936,7 @@ def test_undelete_bucket(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2963,9 +2979,10 @@ def test_undelete_bucket_non_empty_request_with_auto_populated_field(): client.undelete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UndeleteBucketRequest( + request_msg = logging_config.UndeleteBucketRequest( name='name_value', ) + assert args[0] == request_msg def test_undelete_bucket_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3034,7 +3051,11 @@ async def test_undelete_bucket_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UndeleteBucketRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UndeleteBucketRequest({ }), + { }, +]) +async def test_undelete_bucket_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3042,7 +3063,7 @@ async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3061,11 +3082,6 @@ async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_undelete_bucket_async_from_dict(): - await test_undelete_bucket_async(request_type=dict) - def test_undelete_bucket_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3130,8 +3146,10 @@ async def test_undelete_bucket_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListViewsRequest, - dict, + logging_config.ListViewsRequest({ + }), + { + }, ]) def test__list_views(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -3141,7 +3159,7 @@ def test__list_views(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3188,10 +3206,11 @@ def test__list_views_non_empty_request_with_auto_populated_field(): client._list_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListViewsRequest( + request_msg = logging_config.ListViewsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test__list_views_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3260,7 +3279,11 @@ async def test__list_views_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__list_views_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListViewsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListViewsRequest({ }), + { }, +]) +async def test__list_views_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3268,7 +3291,7 @@ async def test__list_views_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3290,11 +3313,6 @@ async def test__list_views_async(transport: str = 'grpc_asyncio', request_type=l assert isinstance(response, pagers.ListViewsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test__list_views_async_from_dict(): - await test__list_views_async(request_type=dict) - def test__list_views_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3635,8 +3653,10 @@ async def test__list_views_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetViewRequest, - dict, + logging_config.GetViewRequest({ + }), + { + }, ]) def test__get_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -3646,7 +3666,7 @@ def test__get_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3696,9 +3716,10 @@ def test__get_view_non_empty_request_with_auto_populated_field(): client._get_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetViewRequest( + request_msg = logging_config.GetViewRequest( name='name_value', ) + assert args[0] == request_msg def test__get_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3767,7 +3788,11 @@ async def test__get_view_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetViewRequest({ }), + { }, +]) +async def test__get_view_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3775,7 +3800,7 @@ async def test__get_view_async(transport: str = 'grpc_asyncio', request_type=log # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3801,11 +3826,6 @@ async def test__get_view_async(transport: str = 'grpc_asyncio', request_type=log assert response.description == 'description_value' assert response.filter == 'filter_value' - -@pytest.mark.asyncio -async def test__get_view_async_from_dict(): - await test__get_view_async(request_type=dict) - def test__get_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3870,8 +3890,10 @@ async def test__get_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateViewRequest, - dict, + logging_config.CreateViewRequest({ + }), + { + }, ]) def test__create_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -3881,7 +3903,7 @@ def test__create_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3932,10 +3954,11 @@ def test__create_view_non_empty_request_with_auto_populated_field(): client._create_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateViewRequest( + request_msg = logging_config.CreateViewRequest( parent='parent_value', view_id='view_id_value', ) + assert args[0] == request_msg def test__create_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4004,7 +4027,11 @@ async def test__create_view_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__create_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateViewRequest({ }), + { }, +]) +async def test__create_view_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4012,7 +4039,7 @@ async def test__create_view_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4038,11 +4065,6 @@ async def test__create_view_async(transport: str = 'grpc_asyncio', request_type= assert response.description == 'description_value' assert response.filter == 'filter_value' - -@pytest.mark.asyncio -async def test__create_view_async_from_dict(): - await test__create_view_async(request_type=dict) - def test__create_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4107,8 +4129,10 @@ async def test__create_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateViewRequest, - dict, + logging_config.UpdateViewRequest({ + }), + { + }, ]) def test__update_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -4118,7 +4142,7 @@ def test__update_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4168,9 +4192,10 @@ def test__update_view_non_empty_request_with_auto_populated_field(): client._update_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateViewRequest( + request_msg = logging_config.UpdateViewRequest( name='name_value', ) + assert args[0] == request_msg def test__update_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4239,7 +4264,11 @@ async def test__update_view_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__update_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateViewRequest({ }), + { }, +]) +async def test__update_view_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4247,7 +4276,7 @@ async def test__update_view_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4273,11 +4302,6 @@ async def test__update_view_async(transport: str = 'grpc_asyncio', request_type= assert response.description == 'description_value' assert response.filter == 'filter_value' - -@pytest.mark.asyncio -async def test__update_view_async_from_dict(): - await test__update_view_async(request_type=dict) - def test__update_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4342,8 +4366,10 @@ async def test__update_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteViewRequest, - dict, + logging_config.DeleteViewRequest({ + }), + { + }, ]) def test__delete_view(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -4353,7 +4379,7 @@ def test__delete_view(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4396,9 +4422,10 @@ def test__delete_view_non_empty_request_with_auto_populated_field(): client._delete_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteViewRequest( + request_msg = logging_config.DeleteViewRequest( name='name_value', ) + assert args[0] == request_msg def test__delete_view_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4467,7 +4494,11 @@ async def test__delete_view_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__delete_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteViewRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteViewRequest({ }), + { }, +]) +async def test__delete_view_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4475,7 +4506,7 @@ async def test__delete_view_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4494,11 +4525,6 @@ async def test__delete_view_async(transport: str = 'grpc_asyncio', request_type= # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test__delete_view_async_from_dict(): - await test__delete_view_async(request_type=dict) - def test__delete_view_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4563,8 +4589,10 @@ async def test__delete_view_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListSinksRequest, - dict, + logging_config.ListSinksRequest({ + }), + { + }, ]) def test__list_sinks(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -4574,7 +4602,7 @@ def test__list_sinks(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4621,10 +4649,11 @@ def test__list_sinks_non_empty_request_with_auto_populated_field(): client._list_sinks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListSinksRequest( + request_msg = logging_config.ListSinksRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test__list_sinks_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4693,7 +4722,11 @@ async def test__list_sinks_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__list_sinks_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListSinksRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListSinksRequest({ }), + { }, +]) +async def test__list_sinks_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4701,7 +4734,7 @@ async def test__list_sinks_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4723,11 +4756,6 @@ async def test__list_sinks_async(transport: str = 'grpc_asyncio', request_type=l assert isinstance(response, pagers.ListSinksAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test__list_sinks_async_from_dict(): - await test__list_sinks_async(request_type=dict) - def test__list_sinks_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5068,8 +5096,10 @@ async def test__list_sinks_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetSinkRequest, - dict, + logging_config.GetSinkRequest({ + }), + { + }, ]) def test__get_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -5079,7 +5109,7 @@ def test__get_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5139,9 +5169,10 @@ def test__get_sink_non_empty_request_with_auto_populated_field(): client._get_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSinkRequest( + request_msg = logging_config.GetSinkRequest( sink_name='sink_name_value', ) + assert args[0] == request_msg def test__get_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5210,7 +5241,11 @@ async def test__get_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetSinkRequest({ }), + { }, +]) +async def test__get_sink_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5218,7 +5253,7 @@ async def test__get_sink_async(transport: str = 'grpc_asyncio', request_type=log # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5254,11 +5289,6 @@ async def test__get_sink_async(transport: str = 'grpc_asyncio', request_type=log assert response.writer_identity == 'writer_identity_value' assert response.include_children is True - -@pytest.mark.asyncio -async def test__get_sink_async_from_dict(): - await test__get_sink_async(request_type=dict) - def test__get_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5405,8 +5435,10 @@ async def test__get_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateSinkRequest, - dict, + logging_config.CreateSinkRequest({ + }), + { + }, ]) def test__create_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -5416,7 +5448,7 @@ def test__create_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5476,9 +5508,10 @@ def test__create_sink_non_empty_request_with_auto_populated_field(): client._create_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateSinkRequest( + request_msg = logging_config.CreateSinkRequest( parent='parent_value', ) + assert args[0] == request_msg def test__create_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5547,7 +5580,11 @@ async def test__create_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__create_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateSinkRequest({ }), + { }, +]) +async def test__create_sink_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5555,7 +5592,7 @@ async def test__create_sink_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5591,11 +5628,6 @@ async def test__create_sink_async(transport: str = 'grpc_asyncio', request_type= assert response.writer_identity == 'writer_identity_value' assert response.include_children is True - -@pytest.mark.asyncio -async def test__create_sink_async_from_dict(): - await test__create_sink_async(request_type=dict) - def test__create_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5752,8 +5784,10 @@ async def test__create_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSinkRequest, - dict, + logging_config.UpdateSinkRequest({ + }), + { + }, ]) def test__update_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -5763,7 +5797,7 @@ def test__update_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5823,9 +5857,10 @@ def test__update_sink_non_empty_request_with_auto_populated_field(): client._update_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSinkRequest( + request_msg = logging_config.UpdateSinkRequest( sink_name='sink_name_value', ) + assert args[0] == request_msg def test__update_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -5894,7 +5929,11 @@ async def test__update_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__update_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateSinkRequest({ }), + { }, +]) +async def test__update_sink_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5902,7 +5941,7 @@ async def test__update_sink_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5938,11 +5977,6 @@ async def test__update_sink_async(transport: str = 'grpc_asyncio', request_type= assert response.writer_identity == 'writer_identity_value' assert response.include_children is True - -@pytest.mark.asyncio -async def test__update_sink_async_from_dict(): - await test__update_sink_async(request_type=dict) - def test__update_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6109,8 +6143,10 @@ async def test__update_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteSinkRequest, - dict, + logging_config.DeleteSinkRequest({ + }), + { + }, ]) def test__delete_sink(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -6120,7 +6156,7 @@ def test__delete_sink(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6163,9 +6199,10 @@ def test__delete_sink_non_empty_request_with_auto_populated_field(): client._delete_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteSinkRequest( + request_msg = logging_config.DeleteSinkRequest( sink_name='sink_name_value', ) + assert args[0] == request_msg def test__delete_sink_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6234,7 +6271,11 @@ async def test__delete_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__delete_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteSinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteSinkRequest({ }), + { }, +]) +async def test__delete_sink_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6242,7 +6283,7 @@ async def test__delete_sink_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6261,11 +6302,6 @@ async def test__delete_sink_async(transport: str = 'grpc_asyncio', request_type= # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test__delete_sink_async_from_dict(): - await test__delete_sink_async(request_type=dict) - def test__delete_sink_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6412,8 +6448,10 @@ async def test__delete_sink_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateLinkRequest, - dict, + logging_config.CreateLinkRequest({ + }), + { + }, ]) def test__create_link(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -6423,7 +6461,7 @@ def test__create_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6467,10 +6505,11 @@ def test__create_link_non_empty_request_with_auto_populated_field(): client._create_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateLinkRequest( + request_msg = logging_config.CreateLinkRequest( parent='parent_value', link_id='link_id_value', ) + assert args[0] == request_msg def test__create_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6549,7 +6588,11 @@ async def test__create_link_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__create_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateLinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateLinkRequest({ }), + { }, +]) +async def test__create_link_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6557,7 +6600,7 @@ async def test__create_link_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6578,11 +6621,6 @@ async def test__create_link_async(transport: str = 'grpc_asyncio', request_type= # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test__create_link_async_from_dict(): - await test__create_link_async(request_type=dict) - def test__create_link_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6751,8 +6789,10 @@ async def test__create_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteLinkRequest, - dict, + logging_config.DeleteLinkRequest({ + }), + { + }, ]) def test__delete_link(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -6762,7 +6802,7 @@ def test__delete_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6805,9 +6845,10 @@ def test__delete_link_non_empty_request_with_auto_populated_field(): client._delete_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteLinkRequest( + request_msg = logging_config.DeleteLinkRequest( name='name_value', ) + assert args[0] == request_msg def test__delete_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -6886,7 +6927,11 @@ async def test__delete_link_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__delete_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteLinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteLinkRequest({ }), + { }, +]) +async def test__delete_link_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6894,7 +6939,7 @@ async def test__delete_link_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6915,11 +6960,6 @@ async def test__delete_link_async(transport: str = 'grpc_asyncio', request_type= # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test__delete_link_async_from_dict(): - await test__delete_link_async(request_type=dict) - def test__delete_link_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7068,8 +7108,10 @@ async def test__delete_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListLinksRequest, - dict, + logging_config.ListLinksRequest({ + }), + { + }, ]) def test__list_links(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -7079,7 +7121,7 @@ def test__list_links(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7126,10 +7168,11 @@ def test__list_links_non_empty_request_with_auto_populated_field(): client._list_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListLinksRequest( + request_msg = logging_config.ListLinksRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test__list_links_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7198,7 +7241,11 @@ async def test__list_links_async_use_cached_wrapped_rpc(transport: str = "grpc_a assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__list_links_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListLinksRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListLinksRequest({ }), + { }, +]) +async def test__list_links_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7206,7 +7253,7 @@ async def test__list_links_async(transport: str = 'grpc_asyncio', request_type=l # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7228,11 +7275,6 @@ async def test__list_links_async(transport: str = 'grpc_asyncio', request_type=l assert isinstance(response, pagers.ListLinksAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test__list_links_async_from_dict(): - await test__list_links_async(request_type=dict) - def test__list_links_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7573,8 +7615,10 @@ async def test__list_links_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetLinkRequest, - dict, + logging_config.GetLinkRequest({ + }), + { + }, ]) def test__get_link(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -7584,7 +7628,7 @@ def test__get_link(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7634,9 +7678,10 @@ def test__get_link_non_empty_request_with_auto_populated_field(): client._get_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetLinkRequest( + request_msg = logging_config.GetLinkRequest( name='name_value', ) + assert args[0] == request_msg def test__get_link_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -7705,7 +7750,11 @@ async def test__get_link_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetLinkRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetLinkRequest({ }), + { }, +]) +async def test__get_link_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7713,7 +7762,7 @@ async def test__get_link_async(transport: str = 'grpc_asyncio', request_type=log # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7739,11 +7788,6 @@ async def test__get_link_async(transport: str = 'grpc_asyncio', request_type=log assert response.description == 'description_value' assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE - -@pytest.mark.asyncio -async def test__get_link_async_from_dict(): - await test__get_link_async(request_type=dict) - def test__get_link_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7890,8 +7934,10 @@ async def test__get_link_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.ListExclusionsRequest, - dict, + logging_config.ListExclusionsRequest({ + }), + { + }, ]) def test__list_exclusions(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -7901,7 +7947,7 @@ def test__list_exclusions(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7948,10 +7994,11 @@ def test__list_exclusions_non_empty_request_with_auto_populated_field(): client._list_exclusions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListExclusionsRequest( + request_msg = logging_config.ListExclusionsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test__list_exclusions_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8020,7 +8067,11 @@ async def test__list_exclusions_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__list_exclusions_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListExclusionsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.ListExclusionsRequest({ }), + { }, +]) +async def test__list_exclusions_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8028,7 +8079,7 @@ async def test__list_exclusions_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8050,11 +8101,6 @@ async def test__list_exclusions_async(transport: str = 'grpc_asyncio', request_t assert isinstance(response, pagers.ListExclusionsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test__list_exclusions_async_from_dict(): - await test__list_exclusions_async(request_type=dict) - def test__list_exclusions_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8395,8 +8441,10 @@ async def test__list_exclusions_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_config.GetExclusionRequest, - dict, + logging_config.GetExclusionRequest({ + }), + { + }, ]) def test__get_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -8406,7 +8454,7 @@ def test__get_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8458,9 +8506,10 @@ def test__get_exclusion_non_empty_request_with_auto_populated_field(): client._get_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetExclusionRequest( + request_msg = logging_config.GetExclusionRequest( name='name_value', ) + assert args[0] == request_msg def test__get_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8529,7 +8578,11 @@ async def test__get_exclusion_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetExclusionRequest({ }), + { }, +]) +async def test__get_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8537,7 +8590,7 @@ async def test__get_exclusion_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8565,11 +8618,6 @@ async def test__get_exclusion_async(transport: str = 'grpc_asyncio', request_typ assert response.filter == 'filter_value' assert response.disabled is True - -@pytest.mark.asyncio -async def test__get_exclusion_async_from_dict(): - await test__get_exclusion_async(request_type=dict) - def test__get_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8716,8 +8764,10 @@ async def test__get_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CreateExclusionRequest, - dict, + logging_config.CreateExclusionRequest({ + }), + { + }, ]) def test__create_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -8727,7 +8777,7 @@ def test__create_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8779,9 +8829,10 @@ def test__create_exclusion_non_empty_request_with_auto_populated_field(): client._create_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateExclusionRequest( + request_msg = logging_config.CreateExclusionRequest( parent='parent_value', ) + assert args[0] == request_msg def test__create_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -8850,7 +8901,11 @@ async def test__create_exclusion_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__create_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CreateExclusionRequest({ }), + { }, +]) +async def test__create_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8858,7 +8913,7 @@ async def test__create_exclusion_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8886,11 +8941,6 @@ async def test__create_exclusion_async(transport: str = 'grpc_asyncio', request_ assert response.filter == 'filter_value' assert response.disabled is True - -@pytest.mark.asyncio -async def test__create_exclusion_async_from_dict(): - await test__create_exclusion_async(request_type=dict) - def test__create_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9047,8 +9097,10 @@ async def test__create_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateExclusionRequest, - dict, + logging_config.UpdateExclusionRequest({ + }), + { + }, ]) def test__update_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9058,7 +9110,7 @@ def test__update_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9110,9 +9162,10 @@ def test__update_exclusion_non_empty_request_with_auto_populated_field(): client._update_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateExclusionRequest( + request_msg = logging_config.UpdateExclusionRequest( name='name_value', ) + assert args[0] == request_msg def test__update_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9181,7 +9234,11 @@ async def test__update_exclusion_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__update_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateExclusionRequest({ }), + { }, +]) +async def test__update_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9189,7 +9246,7 @@ async def test__update_exclusion_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9217,11 +9274,6 @@ async def test__update_exclusion_async(transport: str = 'grpc_asyncio', request_ assert response.filter == 'filter_value' assert response.disabled is True - -@pytest.mark.asyncio -async def test__update_exclusion_async_from_dict(): - await test__update_exclusion_async(request_type=dict) - def test__update_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9388,8 +9440,10 @@ async def test__update_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.DeleteExclusionRequest, - dict, + logging_config.DeleteExclusionRequest({ + }), + { + }, ]) def test__delete_exclusion(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9399,7 +9453,7 @@ def test__delete_exclusion(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9442,9 +9496,10 @@ def test__delete_exclusion_non_empty_request_with_auto_populated_field(): client._delete_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteExclusionRequest( + request_msg = logging_config.DeleteExclusionRequest( name='name_value', ) + assert args[0] == request_msg def test__delete_exclusion_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9513,7 +9568,11 @@ async def test__delete_exclusion_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__delete_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteExclusionRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.DeleteExclusionRequest({ }), + { }, +]) +async def test__delete_exclusion_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9521,7 +9580,7 @@ async def test__delete_exclusion_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9540,11 +9599,6 @@ async def test__delete_exclusion_async(transport: str = 'grpc_asyncio', request_ # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test__delete_exclusion_async_from_dict(): - await test__delete_exclusion_async(request_type=dict) - def test__delete_exclusion_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9691,8 +9745,10 @@ async def test__delete_exclusion_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetCmekSettingsRequest, - dict, + logging_config.GetCmekSettingsRequest({ + }), + { + }, ]) def test__get_cmek_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9702,7 +9758,7 @@ def test__get_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9754,9 +9810,10 @@ def test__get_cmek_settings_non_empty_request_with_auto_populated_field(): client._get_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetCmekSettingsRequest( + request_msg = logging_config.GetCmekSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test__get_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -9825,7 +9882,11 @@ async def test__get_cmek_settings_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetCmekSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetCmekSettingsRequest({ }), + { }, +]) +async def test__get_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9833,7 +9894,7 @@ async def test__get_cmek_settings_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9861,11 +9922,6 @@ async def test__get_cmek_settings_async(transport: str = 'grpc_asyncio', request assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' - -@pytest.mark.asyncio -async def test__get_cmek_settings_async_from_dict(): - await test__get_cmek_settings_async(request_type=dict) - def test__get_cmek_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9930,8 +9986,10 @@ async def test__get_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateCmekSettingsRequest, - dict, + logging_config.UpdateCmekSettingsRequest({ + }), + { + }, ]) def test__update_cmek_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -9941,7 +9999,7 @@ def test__update_cmek_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9993,9 +10051,10 @@ def test__update_cmek_settings_non_empty_request_with_auto_populated_field(): client._update_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateCmekSettingsRequest( + request_msg = logging_config.UpdateCmekSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test__update_cmek_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10064,7 +10123,11 @@ async def test__update_cmek_settings_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__update_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateCmekSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateCmekSettingsRequest({ }), + { }, +]) +async def test__update_cmek_settings_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10072,7 +10135,7 @@ async def test__update_cmek_settings_async(transport: str = 'grpc_asyncio', requ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10100,11 +10163,6 @@ async def test__update_cmek_settings_async(transport: str = 'grpc_asyncio', requ assert response.kms_key_version_name == 'kms_key_version_name_value' assert response.service_account_id == 'service_account_id_value' - -@pytest.mark.asyncio -async def test__update_cmek_settings_async_from_dict(): - await test__update_cmek_settings_async(request_type=dict) - def test__update_cmek_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10169,8 +10227,10 @@ async def test__update_cmek_settings_field_headers_async(): @pytest.mark.parametrize("request_type", [ - logging_config.GetSettingsRequest, - dict, + logging_config.GetSettingsRequest({ + }), + { + }, ]) def test__get_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -10180,7 +10240,7 @@ def test__get_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10234,9 +10294,10 @@ def test__get_settings_non_empty_request_with_auto_populated_field(): client._get_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSettingsRequest( + request_msg = logging_config.GetSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test__get_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10305,7 +10366,11 @@ async def test__get_settings_async_use_cached_wrapped_rpc(transport: str = "grpc assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.GetSettingsRequest({ }), + { }, +]) +async def test__get_settings_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10313,7 +10378,7 @@ async def test__get_settings_async(transport: str = 'grpc_asyncio', request_type # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10343,11 +10408,6 @@ async def test__get_settings_async(transport: str = 'grpc_asyncio', request_type assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True - -@pytest.mark.asyncio -async def test__get_settings_async_from_dict(): - await test__get_settings_async(request_type=dict) - def test__get_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10494,8 +10554,10 @@ async def test__get_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.UpdateSettingsRequest, - dict, + logging_config.UpdateSettingsRequest({ + }), + { + }, ]) def test__update_settings(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -10505,7 +10567,7 @@ def test__update_settings(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10559,9 +10621,10 @@ def test__update_settings_non_empty_request_with_auto_populated_field(): client._update_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSettingsRequest( + request_msg = logging_config.UpdateSettingsRequest( name='name_value', ) + assert args[0] == request_msg def test__update_settings_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10630,7 +10693,11 @@ async def test__update_settings_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__update_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSettingsRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.UpdateSettingsRequest({ }), + { }, +]) +async def test__update_settings_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10638,7 +10705,7 @@ async def test__update_settings_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10668,11 +10735,6 @@ async def test__update_settings_async(transport: str = 'grpc_asyncio', request_t assert response.storage_location == 'storage_location_value' assert response.disable_default_sink is True - -@pytest.mark.asyncio -async def test__update_settings_async_from_dict(): - await test__update_settings_async(request_type=dict) - def test__update_settings_field_headers(): client = BaseConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10829,8 +10891,10 @@ async def test__update_settings_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_config.CopyLogEntriesRequest, - dict, + logging_config.CopyLogEntriesRequest({ + }), + { + }, ]) def test__copy_log_entries(request_type, transport: str = 'grpc'): client = BaseConfigServiceV2Client( @@ -10840,7 +10904,7 @@ def test__copy_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10885,11 +10949,12 @@ def test__copy_log_entries_non_empty_request_with_auto_populated_field(): client._copy_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CopyLogEntriesRequest( + request_msg = logging_config.CopyLogEntriesRequest( name='name_value', filter='filter_value', destination='destination_value', ) + assert args[0] == request_msg def test__copy_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -10968,7 +11033,11 @@ async def test__copy_log_entries_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__copy_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging_config.CopyLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging_config.CopyLogEntriesRequest({ }), + { }, +]) +async def test__copy_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = BaseConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10976,7 +11045,7 @@ async def test__copy_log_entries_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10998,11 +11067,6 @@ async def test__copy_log_entries_async(transport: str = 'grpc_asyncio', request_ assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test__copy_log_entries_async_from_dict(): - await test__copy_log_entries_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ConfigServiceV2GrpcTransport( @@ -11123,7 +11187,6 @@ def test_list_buckets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() - assert args[0] == request_msg @@ -11146,7 +11209,6 @@ def test_get_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() - assert args[0] == request_msg @@ -11169,7 +11231,6 @@ def test_create_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11192,7 +11253,6 @@ def test_update_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -11215,7 +11275,6 @@ def test_create_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11238,7 +11297,6 @@ def test_update_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -11261,7 +11319,6 @@ def test_delete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() - assert args[0] == request_msg @@ -11284,7 +11341,6 @@ def test_undelete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() - assert args[0] == request_msg @@ -11307,7 +11363,6 @@ def test__list_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() - assert args[0] == request_msg @@ -11330,7 +11385,6 @@ def test__get_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() - assert args[0] == request_msg @@ -11353,7 +11407,6 @@ def test__create_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() - assert args[0] == request_msg @@ -11376,7 +11429,6 @@ def test__update_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() - assert args[0] == request_msg @@ -11399,7 +11451,6 @@ def test__delete_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() - assert args[0] == request_msg @@ -11422,7 +11473,6 @@ def test__list_sinks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() - assert args[0] == request_msg @@ -11445,7 +11495,6 @@ def test__get_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() - assert args[0] == request_msg @@ -11468,7 +11517,6 @@ def test__create_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() - assert args[0] == request_msg @@ -11491,7 +11539,6 @@ def test__update_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() - assert args[0] == request_msg @@ -11514,7 +11561,6 @@ def test__delete_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() - assert args[0] == request_msg @@ -11537,7 +11583,6 @@ def test__create_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() - assert args[0] == request_msg @@ -11560,7 +11605,6 @@ def test__delete_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() - assert args[0] == request_msg @@ -11583,7 +11627,6 @@ def test__list_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() - assert args[0] == request_msg @@ -11606,7 +11649,6 @@ def test__get_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() - assert args[0] == request_msg @@ -11629,7 +11671,6 @@ def test__list_exclusions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() - assert args[0] == request_msg @@ -11652,7 +11693,6 @@ def test__get_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() - assert args[0] == request_msg @@ -11675,7 +11715,6 @@ def test__create_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() - assert args[0] == request_msg @@ -11698,7 +11737,6 @@ def test__update_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() - assert args[0] == request_msg @@ -11721,7 +11759,6 @@ def test__delete_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() - assert args[0] == request_msg @@ -11744,7 +11781,6 @@ def test__get_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() - assert args[0] == request_msg @@ -11767,7 +11803,6 @@ def test__update_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() - assert args[0] == request_msg @@ -11790,7 +11825,6 @@ def test__get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() - assert args[0] == request_msg @@ -11813,7 +11847,6 @@ def test__update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() - assert args[0] == request_msg @@ -11836,7 +11869,6 @@ def test__copy_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() - assert args[0] == request_msg @@ -11878,7 +11910,6 @@ async def test_list_buckets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() - assert args[0] == request_msg @@ -11911,7 +11942,6 @@ async def test_get_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() - assert args[0] == request_msg @@ -11938,7 +11968,6 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11965,7 +11994,6 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -11998,7 +12026,6 @@ async def test_create_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -12031,7 +12058,6 @@ async def test_update_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -12056,7 +12082,6 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() - assert args[0] == request_msg @@ -12081,7 +12106,6 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() - assert args[0] == request_msg @@ -12108,7 +12132,6 @@ async def test__list_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() - assert args[0] == request_msg @@ -12137,7 +12160,6 @@ async def test__get_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() - assert args[0] == request_msg @@ -12166,7 +12188,6 @@ async def test__create_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() - assert args[0] == request_msg @@ -12195,7 +12216,6 @@ async def test__update_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() - assert args[0] == request_msg @@ -12220,7 +12240,6 @@ async def test__delete_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() - assert args[0] == request_msg @@ -12247,7 +12266,6 @@ async def test__list_sinks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() - assert args[0] == request_msg @@ -12281,7 +12299,6 @@ async def test__get_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() - assert args[0] == request_msg @@ -12315,7 +12332,6 @@ async def test__create_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() - assert args[0] == request_msg @@ -12349,7 +12365,6 @@ async def test__update_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() - assert args[0] == request_msg @@ -12374,7 +12389,6 @@ async def test__delete_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() - assert args[0] == request_msg @@ -12401,7 +12415,6 @@ async def test__create_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() - assert args[0] == request_msg @@ -12428,7 +12441,6 @@ async def test__delete_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() - assert args[0] == request_msg @@ -12455,7 +12467,6 @@ async def test__list_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() - assert args[0] == request_msg @@ -12484,7 +12495,6 @@ async def test__get_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() - assert args[0] == request_msg @@ -12511,7 +12521,6 @@ async def test__list_exclusions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() - assert args[0] == request_msg @@ -12541,7 +12550,6 @@ async def test__get_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() - assert args[0] == request_msg @@ -12571,7 +12579,6 @@ async def test__create_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() - assert args[0] == request_msg @@ -12601,7 +12608,6 @@ async def test__update_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() - assert args[0] == request_msg @@ -12626,7 +12632,6 @@ async def test__delete_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() - assert args[0] == request_msg @@ -12656,7 +12661,6 @@ async def test__get_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() - assert args[0] == request_msg @@ -12686,7 +12690,6 @@ async def test__update_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() - assert args[0] == request_msg @@ -12717,7 +12720,6 @@ async def test__get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() - assert args[0] == request_msg @@ -12748,7 +12750,6 @@ async def test__update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() - assert args[0] == request_msg @@ -12775,7 +12776,6 @@ async def test__copy_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py index c843e973f7ca..d17295af4442 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -962,8 +962,10 @@ def test_logging_service_v2_client_create_channel_credentials_file(client_class, @pytest.mark.parametrize("request_type", [ - logging.DeleteLogRequest, - dict, + logging.DeleteLogRequest({ + }), + { + }, ]) def test_delete_log(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -973,7 +975,7 @@ def test_delete_log(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1016,9 +1018,10 @@ def test_delete_log_non_empty_request_with_auto_populated_field(): client.delete_log(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.DeleteLogRequest( + request_msg = logging.DeleteLogRequest( log_name='log_name_value', ) + assert args[0] == request_msg def test_delete_log_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1087,7 +1090,11 @@ async def test_delete_log_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=logging.DeleteLogRequest): +@pytest.mark.parametrize("request_type", [ + logging.DeleteLogRequest({ }), + { }, +]) +async def test_delete_log_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1095,7 +1102,7 @@ async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=lo # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1114,11 +1121,6 @@ async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_log_async_from_dict(): - await test_delete_log_async(request_type=dict) - def test_delete_log_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1265,8 +1267,10 @@ async def test_delete_log_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.WriteLogEntriesRequest, - dict, + logging.WriteLogEntriesRequest({ + }), + { + }, ]) def test_write_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1276,7 +1280,7 @@ def test_write_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1320,9 +1324,10 @@ def test_write_log_entries_non_empty_request_with_auto_populated_field(): client.write_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.WriteLogEntriesRequest( + request_msg = logging.WriteLogEntriesRequest( log_name='log_name_value', ) + assert args[0] == request_msg def test_write_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1391,7 +1396,11 @@ async def test_write_log_entries_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.WriteLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging.WriteLogEntriesRequest({ }), + { }, +]) +async def test_write_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1399,7 +1408,7 @@ async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1420,11 +1429,6 @@ async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_ assert isinstance(response, logging.WriteLogEntriesResponse) -@pytest.mark.asyncio -async def test_write_log_entries_async_from_dict(): - await test_write_log_entries_async(request_type=dict) - - def test_write_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1538,8 +1542,10 @@ async def test_write_log_entries_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging.ListLogEntriesRequest, - dict, + logging.ListLogEntriesRequest({ + }), + { + }, ]) def test_list_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -1549,7 +1555,7 @@ def test_list_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1597,11 +1603,12 @@ def test_list_log_entries_non_empty_request_with_auto_populated_field(): client.list_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogEntriesRequest( + request_msg = logging.ListLogEntriesRequest( filter='filter_value', order_by='order_by_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1670,7 +1677,11 @@ async def test_list_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging.ListLogEntriesRequest({ }), + { }, +]) +async def test_list_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1678,7 +1689,7 @@ async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1701,11 +1712,6 @@ async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_t assert response.next_page_token == 'next_page_token_value' -@pytest.mark.asyncio -async def test_list_log_entries_async_from_dict(): - await test_list_log_entries_async(request_type=dict) - - def test_list_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1998,8 +2004,10 @@ async def test_list_log_entries_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListMonitoredResourceDescriptorsRequest, - dict, + logging.ListMonitoredResourceDescriptorsRequest({ + }), + { + }, ]) def test_list_monitored_resource_descriptors(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2009,7 +2017,7 @@ def test_list_monitored_resource_descriptors(request_type, transport: str = 'grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2055,9 +2063,10 @@ def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populat client.list_monitored_resource_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListMonitoredResourceDescriptorsRequest( + request_msg = logging.ListMonitoredResourceDescriptorsRequest( page_token='page_token_value', ) + assert args[0] == request_msg def test_list_monitored_resource_descriptors_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2126,7 +2135,11 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_asyncio', request_type=logging.ListMonitoredResourceDescriptorsRequest): +@pytest.mark.parametrize("request_type", [ + logging.ListMonitoredResourceDescriptorsRequest({ }), + { }, +]) +async def test_list_monitored_resource_descriptors_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2134,7 +2147,7 @@ async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2157,11 +2170,6 @@ async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_ assert response.next_page_token == 'next_page_token_value' -@pytest.mark.asyncio -async def test_list_monitored_resource_descriptors_async_from_dict(): - await test_list_monitored_resource_descriptors_async(request_type=dict) - - def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc"): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2352,8 +2360,10 @@ async def test_list_monitored_resource_descriptors_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.ListLogsRequest, - dict, + logging.ListLogsRequest({ + }), + { + }, ]) def test_list_logs(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2363,7 +2373,7 @@ def test_list_logs(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2412,10 +2422,11 @@ def test_list_logs_non_empty_request_with_auto_populated_field(): client.list_logs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogsRequest( + request_msg = logging.ListLogsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_logs_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2484,7 +2495,11 @@ async def test_list_logs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogsRequest): +@pytest.mark.parametrize("request_type", [ + logging.ListLogsRequest({ }), + { }, +]) +async def test_list_logs_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2492,7 +2507,7 @@ async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=log # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2516,11 +2531,6 @@ async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=log assert response.log_names == ['log_names_value'] assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test_list_logs_async_from_dict(): - await test_list_logs_async(request_type=dict) - def test_list_logs_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2861,8 +2871,10 @@ async def test_list_logs_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging.TailLogEntriesRequest, - dict, + logging.TailLogEntriesRequest({ + }), + { + }, ]) def test_tail_log_entries(request_type, transport: str = 'grpc'): client = LoggingServiceV2Client( @@ -2872,7 +2884,7 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2892,7 +2904,6 @@ def test_tail_log_entries(request_type, transport: str = 'grpc'): for message in response: assert isinstance(message, logging.TailLogEntriesResponse) - def test_tail_log_entries_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2960,7 +2971,11 @@ async def test_tail_log_entries_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.TailLogEntriesRequest): +@pytest.mark.parametrize("request_type", [ + logging.TailLogEntriesRequest({ }), + { }, +]) +async def test_tail_log_entries_async(request_type, transport: str = 'grpc_asyncio'): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2968,7 +2983,7 @@ async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -2990,11 +3005,6 @@ async def test_tail_log_entries_async(transport: str = 'grpc_asyncio', request_t assert isinstance(message, logging.TailLogEntriesResponse) -@pytest.mark.asyncio -async def test_tail_log_entries_async_from_dict(): - await test_tail_log_entries_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LoggingServiceV2GrpcTransport( @@ -3115,7 +3125,6 @@ def test_delete_log_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() - assert args[0] == request_msg @@ -3138,7 +3147,6 @@ def test_write_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() - assert args[0] == request_msg @@ -3161,7 +3169,6 @@ def test_list_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() - assert args[0] == request_msg @@ -3184,7 +3191,6 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -3207,7 +3213,6 @@ def test_list_logs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() - assert args[0] == request_msg @@ -3247,7 +3252,6 @@ async def test_delete_log_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() - assert args[0] == request_msg @@ -3273,7 +3277,6 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() - assert args[0] == request_msg @@ -3300,7 +3303,6 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() - assert args[0] == request_msg @@ -3327,7 +3329,6 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -3355,7 +3356,6 @@ async def test_list_logs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 65f0986892c4..d7d864d25978 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -960,8 +960,10 @@ def test_base_metrics_service_v2_client_create_channel_credentials_file(client_c @pytest.mark.parametrize("request_type", [ - logging_metrics.ListLogMetricsRequest, - dict, + logging_metrics.ListLogMetricsRequest({ + }), + { + }, ]) def test__list_log_metrics(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -971,7 +973,7 @@ def test__list_log_metrics(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1018,10 +1020,11 @@ def test__list_log_metrics_non_empty_request_with_auto_populated_field(): client._list_log_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.ListLogMetricsRequest( + request_msg = logging_metrics.ListLogMetricsRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test__list_log_metrics_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1090,7 +1093,11 @@ async def test__list_log_metrics_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__list_log_metrics_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.ListLogMetricsRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.ListLogMetricsRequest({ }), + { }, +]) +async def test__list_log_metrics_async(request_type, transport: str = 'grpc_asyncio'): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1098,7 +1105,7 @@ async def test__list_log_metrics_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1120,11 +1127,6 @@ async def test__list_log_metrics_async(transport: str = 'grpc_asyncio', request_ assert isinstance(response, pagers.ListLogMetricsAsyncPager) assert response.next_page_token == 'next_page_token_value' - -@pytest.mark.asyncio -async def test__list_log_metrics_async_from_dict(): - await test__list_log_metrics_async(request_type=dict) - def test__list_log_metrics_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1465,8 +1467,10 @@ async def test__list_log_metrics_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - logging_metrics.GetLogMetricRequest, - dict, + logging_metrics.GetLogMetricRequest({ + }), + { + }, ]) def test__get_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -1476,7 +1480,7 @@ def test__get_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1534,9 +1538,10 @@ def test__get_log_metric_non_empty_request_with_auto_populated_field(): client._get_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.GetLogMetricRequest( + request_msg = logging_metrics.GetLogMetricRequest( metric_name='metric_name_value', ) + assert args[0] == request_msg def test__get_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1605,7 +1610,11 @@ async def test__get_log_metric_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__get_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.GetLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.GetLogMetricRequest({ }), + { }, +]) +async def test__get_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1613,7 +1622,7 @@ async def test__get_log_metric_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1647,11 +1656,6 @@ async def test__get_log_metric_async(transport: str = 'grpc_asyncio', request_ty assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 - -@pytest.mark.asyncio -async def test__get_log_metric_async_from_dict(): - await test__get_log_metric_async(request_type=dict) - def test__get_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1798,8 +1802,10 @@ async def test__get_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.CreateLogMetricRequest, - dict, + logging_metrics.CreateLogMetricRequest({ + }), + { + }, ]) def test__create_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -1809,7 +1815,7 @@ def test__create_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1867,9 +1873,10 @@ def test__create_log_metric_non_empty_request_with_auto_populated_field(): client._create_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.CreateLogMetricRequest( + request_msg = logging_metrics.CreateLogMetricRequest( parent='parent_value', ) + assert args[0] == request_msg def test__create_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1938,7 +1945,11 @@ async def test__create_log_metric_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__create_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.CreateLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.CreateLogMetricRequest({ }), + { }, +]) +async def test__create_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1946,7 +1957,7 @@ async def test__create_log_metric_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1980,11 +1991,6 @@ async def test__create_log_metric_async(transport: str = 'grpc_asyncio', request assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 - -@pytest.mark.asyncio -async def test__create_log_metric_async_from_dict(): - await test__create_log_metric_async(request_type=dict) - def test__create_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2141,8 +2147,10 @@ async def test__create_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.UpdateLogMetricRequest, - dict, + logging_metrics.UpdateLogMetricRequest({ + }), + { + }, ]) def test__update_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -2152,7 +2160,7 @@ def test__update_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2210,9 +2218,10 @@ def test__update_log_metric_non_empty_request_with_auto_populated_field(): client._update_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.UpdateLogMetricRequest( + request_msg = logging_metrics.UpdateLogMetricRequest( metric_name='metric_name_value', ) + assert args[0] == request_msg def test__update_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2281,7 +2290,11 @@ async def test__update_log_metric_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__update_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.UpdateLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.UpdateLogMetricRequest({ }), + { }, +]) +async def test__update_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2289,7 +2302,7 @@ async def test__update_log_metric_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2323,11 +2336,6 @@ async def test__update_log_metric_async(transport: str = 'grpc_asyncio', request assert response.value_extractor == 'value_extractor_value' assert response.version == logging_metrics.LogMetric.ApiVersion.V1 - -@pytest.mark.asyncio -async def test__update_log_metric_async_from_dict(): - await test__update_log_metric_async(request_type=dict) - def test__update_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2484,8 +2492,10 @@ async def test__update_log_metric_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - logging_metrics.DeleteLogMetricRequest, - dict, + logging_metrics.DeleteLogMetricRequest({ + }), + { + }, ]) def test__delete_log_metric(request_type, transport: str = 'grpc'): client = BaseMetricsServiceV2Client( @@ -2495,7 +2505,7 @@ def test__delete_log_metric(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2538,9 +2548,10 @@ def test__delete_log_metric_non_empty_request_with_auto_populated_field(): client._delete_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.DeleteLogMetricRequest( + request_msg = logging_metrics.DeleteLogMetricRequest( metric_name='metric_name_value', ) + assert args[0] == request_msg def test__delete_log_metric_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2609,7 +2620,11 @@ async def test__delete_log_metric_async_use_cached_wrapped_rpc(transport: str = assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test__delete_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.DeleteLogMetricRequest): +@pytest.mark.parametrize("request_type", [ + logging_metrics.DeleteLogMetricRequest({ }), + { }, +]) +async def test__delete_log_metric_async(request_type, transport: str = 'grpc_asyncio'): client = BaseMetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2617,7 +2632,7 @@ async def test__delete_log_metric_async(transport: str = 'grpc_asyncio', request # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2636,11 +2651,6 @@ async def test__delete_log_metric_async(transport: str = 'grpc_asyncio', request # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test__delete_log_metric_async_from_dict(): - await test__delete_log_metric_async(request_type=dict) - def test__delete_log_metric_field_headers(): client = BaseMetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2906,7 +2916,6 @@ def test__list_log_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() - assert args[0] == request_msg @@ -2929,7 +2938,6 @@ def test__get_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() - assert args[0] == request_msg @@ -2952,7 +2960,6 @@ def test__create_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() - assert args[0] == request_msg @@ -2975,7 +2982,6 @@ def test__update_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() - assert args[0] == request_msg @@ -2998,7 +3004,6 @@ def test__delete_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() - assert args[0] == request_msg @@ -3040,7 +3045,6 @@ async def test__list_log_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() - assert args[0] == request_msg @@ -3073,7 +3077,6 @@ async def test__get_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() - assert args[0] == request_msg @@ -3106,7 +3109,6 @@ async def test__create_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() - assert args[0] == request_msg @@ -3139,7 +3141,6 @@ async def test__update_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() - assert args[0] == request_msg @@ -3164,7 +3165,6 @@ async def test__delete_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 4b4130748869..0ded4d75fab1 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -989,8 +989,10 @@ def test_cloud_redis_client_create_channel_credentials_file(client_class, transp @pytest.mark.parametrize("request_type", [ - cloud_redis.ListInstancesRequest, - dict, + cloud_redis.ListInstancesRequest({ + }), + { + }, ]) def test_list_instances(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1000,7 +1002,7 @@ def test_list_instances(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1049,10 +1051,11 @@ def test_list_instances_non_empty_request_with_auto_populated_field(): client.list_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ListInstancesRequest( + request_msg = cloud_redis.ListInstancesRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1121,7 +1124,11 @@ async def test_list_instances_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_instances_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ListInstancesRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.ListInstancesRequest({ }), + { }, +]) +async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1129,7 +1136,7 @@ async def test_list_instances_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1153,11 +1160,6 @@ async def test_list_instances_async(transport: str = 'grpc_asyncio', request_typ assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_instances_async_from_dict(): - await test_list_instances_async(request_type=dict) - def test_list_instances_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1498,8 +1500,10 @@ async def test_list_instances_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceRequest, - dict, + cloud_redis.GetInstanceRequest({ + }), + { + }, ]) def test_get_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1509,7 +1513,7 @@ def test_get_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1607,9 +1611,10 @@ def test_get_instance_non_empty_request_with_auto_populated_field(): client.get_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceRequest( + request_msg = cloud_redis.GetInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1678,7 +1683,11 @@ async def test_get_instance_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.GetInstanceRequest({ }), + { }, +]) +async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1686,7 +1695,7 @@ async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1760,11 +1769,6 @@ async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type= assert response.maintenance_version == 'maintenance_version_value' assert response.available_maintenance_versions == ['available_maintenance_versions_value'] - -@pytest.mark.asyncio -async def test_get_instance_async_from_dict(): - await test_get_instance_async(request_type=dict) - def test_get_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1911,8 +1915,10 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceAuthStringRequest, - dict, + cloud_redis.GetInstanceAuthStringRequest({ + }), + { + }, ]) def test_get_instance_auth_string(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1922,7 +1928,7 @@ def test_get_instance_auth_string(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1968,9 +1974,10 @@ def test_get_instance_auth_string_non_empty_request_with_auto_populated_field(): client.get_instance_auth_string(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceAuthStringRequest( + request_msg = cloud_redis.GetInstanceAuthStringRequest( name='name_value', ) + assert args[0] == request_msg def test_get_instance_auth_string_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2039,7 +2046,11 @@ async def test_get_instance_auth_string_async_use_cached_wrapped_rpc(transport: assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_instance_auth_string_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceAuthStringRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.GetInstanceAuthStringRequest({ }), + { }, +]) +async def test_get_instance_auth_string_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2047,7 +2058,7 @@ async def test_get_instance_auth_string_async(transport: str = 'grpc_asyncio', r # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2069,11 +2080,6 @@ async def test_get_instance_auth_string_async(transport: str = 'grpc_asyncio', r assert isinstance(response, cloud_redis.InstanceAuthString) assert response.auth_string == 'auth_string_value' - -@pytest.mark.asyncio -async def test_get_instance_auth_string_async_from_dict(): - await test_get_instance_auth_string_async(request_type=dict) - def test_get_instance_auth_string_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2220,8 +2226,10 @@ async def test_get_instance_auth_string_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.CreateInstanceRequest, - dict, + cloud_redis.CreateInstanceRequest({ + }), + { + }, ]) def test_create_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2231,7 +2239,7 @@ def test_create_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2275,10 +2283,11 @@ def test_create_instance_non_empty_request_with_auto_populated_field(): client.create_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.CreateInstanceRequest( + request_msg = cloud_redis.CreateInstanceRequest( parent='parent_value', instance_id='instance_id_value', ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2357,7 +2366,11 @@ async def test_create_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.CreateInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.CreateInstanceRequest({ }), + { }, +]) +async def test_create_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2365,7 +2378,7 @@ async def test_create_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2386,11 +2399,6 @@ async def test_create_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_instance_async_from_dict(): - await test_create_instance_async(request_type=dict) - def test_create_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2559,8 +2567,10 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.UpdateInstanceRequest, - dict, + cloud_redis.UpdateInstanceRequest({ + }), + { + }, ]) def test_update_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2570,7 +2580,7 @@ def test_update_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2612,8 +2622,9 @@ def test_update_instance_non_empty_request_with_auto_populated_field(): client.update_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpdateInstanceRequest( + request_msg = cloud_redis.UpdateInstanceRequest( ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2692,7 +2703,11 @@ async def test_update_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpdateInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.UpdateInstanceRequest({ }), + { }, +]) +async def test_update_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2700,7 +2715,7 @@ async def test_update_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2721,11 +2736,6 @@ async def test_update_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_instance_async_from_dict(): - await test_update_instance_async(request_type=dict) - def test_update_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2884,8 +2894,10 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.UpgradeInstanceRequest, - dict, + cloud_redis.UpgradeInstanceRequest({ + }), + { + }, ]) def test_upgrade_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2895,7 +2907,7 @@ def test_upgrade_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2939,10 +2951,11 @@ def test_upgrade_instance_non_empty_request_with_auto_populated_field(): client.upgrade_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpgradeInstanceRequest( + request_msg = cloud_redis.UpgradeInstanceRequest( name='name_value', redis_version='redis_version_value', ) + assert args[0] == request_msg def test_upgrade_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3021,7 +3034,11 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc(transport: str = "g assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_upgrade_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpgradeInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.UpgradeInstanceRequest({ }), + { }, +]) +async def test_upgrade_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3029,7 +3046,7 @@ async def test_upgrade_instance_async(transport: str = 'grpc_asyncio', request_t # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3050,11 +3067,6 @@ async def test_upgrade_instance_async(transport: str = 'grpc_asyncio', request_t # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_upgrade_instance_async_from_dict(): - await test_upgrade_instance_async(request_type=dict) - def test_upgrade_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3213,8 +3225,10 @@ async def test_upgrade_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.ImportInstanceRequest, - dict, + cloud_redis.ImportInstanceRequest({ + }), + { + }, ]) def test_import_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -3224,7 +3238,7 @@ def test_import_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3267,9 +3281,10 @@ def test_import_instance_non_empty_request_with_auto_populated_field(): client.import_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ImportInstanceRequest( + request_msg = cloud_redis.ImportInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_import_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3348,7 +3363,11 @@ async def test_import_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_import_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ImportInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.ImportInstanceRequest({ }), + { }, +]) +async def test_import_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3356,7 +3375,7 @@ async def test_import_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3377,11 +3396,6 @@ async def test_import_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_import_instance_async_from_dict(): - await test_import_instance_async(request_type=dict) - def test_import_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3540,8 +3554,10 @@ async def test_import_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.ExportInstanceRequest, - dict, + cloud_redis.ExportInstanceRequest({ + }), + { + }, ]) def test_export_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -3551,7 +3567,7 @@ def test_export_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3594,9 +3610,10 @@ def test_export_instance_non_empty_request_with_auto_populated_field(): client.export_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ExportInstanceRequest( + request_msg = cloud_redis.ExportInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_export_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3675,7 +3692,11 @@ async def test_export_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_export_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ExportInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.ExportInstanceRequest({ }), + { }, +]) +async def test_export_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3683,7 +3704,7 @@ async def test_export_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3704,11 +3725,6 @@ async def test_export_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_export_instance_async_from_dict(): - await test_export_instance_async(request_type=dict) - def test_export_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3867,8 +3883,10 @@ async def test_export_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.FailoverInstanceRequest, - dict, + cloud_redis.FailoverInstanceRequest({ + }), + { + }, ]) def test_failover_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -3878,7 +3896,7 @@ def test_failover_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3921,9 +3939,10 @@ def test_failover_instance_non_empty_request_with_auto_populated_field(): client.failover_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.FailoverInstanceRequest( + request_msg = cloud_redis.FailoverInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_failover_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4002,7 +4021,11 @@ async def test_failover_instance_async_use_cached_wrapped_rpc(transport: str = " assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_failover_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.FailoverInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.FailoverInstanceRequest({ }), + { }, +]) +async def test_failover_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4010,7 +4033,7 @@ async def test_failover_instance_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4031,11 +4054,6 @@ async def test_failover_instance_async(transport: str = 'grpc_asyncio', request_ # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_failover_instance_async_from_dict(): - await test_failover_instance_async(request_type=dict) - def test_failover_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4194,8 +4212,10 @@ async def test_failover_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.DeleteInstanceRequest, - dict, + cloud_redis.DeleteInstanceRequest({ + }), + { + }, ]) def test_delete_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -4205,7 +4225,7 @@ def test_delete_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4248,9 +4268,10 @@ def test_delete_instance_non_empty_request_with_auto_populated_field(): client.delete_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.DeleteInstanceRequest( + request_msg = cloud_redis.DeleteInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4329,7 +4350,11 @@ async def test_delete_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.DeleteInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.DeleteInstanceRequest({ }), + { }, +]) +async def test_delete_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4337,7 +4362,7 @@ async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4358,11 +4383,6 @@ async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_instance_async_from_dict(): - await test_delete_instance_async(request_type=dict) - def test_delete_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4511,8 +4531,10 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.RescheduleMaintenanceRequest, - dict, + cloud_redis.RescheduleMaintenanceRequest({ + }), + { + }, ]) def test_reschedule_maintenance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -4522,7 +4544,7 @@ def test_reschedule_maintenance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4565,9 +4587,10 @@ def test_reschedule_maintenance_non_empty_request_with_auto_populated_field(): client.reschedule_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.RescheduleMaintenanceRequest( + request_msg = cloud_redis.RescheduleMaintenanceRequest( name='name_value', ) + assert args[0] == request_msg def test_reschedule_maintenance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -4646,7 +4669,11 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc(transport: st assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_reschedule_maintenance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.RescheduleMaintenanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.RescheduleMaintenanceRequest({ }), + { }, +]) +async def test_reschedule_maintenance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4654,7 +4681,7 @@ async def test_reschedule_maintenance_async(transport: str = 'grpc_asyncio', req # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4675,11 +4702,6 @@ async def test_reschedule_maintenance_async(transport: str = 'grpc_asyncio', req # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_reschedule_maintenance_async_from_dict(): - await test_reschedule_maintenance_async(request_type=dict) - def test_reschedule_maintenance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6885,7 +6907,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -6908,7 +6929,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -6931,7 +6951,6 @@ def test_get_instance_auth_string_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() - assert args[0] == request_msg @@ -6954,7 +6973,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -6977,7 +6995,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7000,7 +7017,6 @@ def test_upgrade_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -7023,7 +7039,6 @@ def test_import_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() - assert args[0] == request_msg @@ -7046,7 +7061,6 @@ def test_export_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() - assert args[0] == request_msg @@ -7069,7 +7083,6 @@ def test_failover_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() - assert args[0] == request_msg @@ -7092,7 +7105,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7115,7 +7127,6 @@ def test_reschedule_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -7158,7 +7169,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -7211,7 +7221,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -7238,7 +7247,6 @@ async def test_get_instance_auth_string_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() - assert args[0] == request_msg @@ -7265,7 +7273,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -7292,7 +7299,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7319,7 +7325,6 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -7346,7 +7351,6 @@ async def test_import_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() - assert args[0] == request_msg @@ -7373,7 +7377,6 @@ async def test_export_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() - assert args[0] == request_msg @@ -7400,7 +7403,6 @@ async def test_failover_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() - assert args[0] == request_msg @@ -7427,7 +7429,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7454,7 +7455,6 @@ async def test_reschedule_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -9169,7 +9169,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -9191,7 +9190,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -9213,7 +9211,6 @@ def test_get_instance_auth_string_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() - assert args[0] == request_msg @@ -9235,7 +9232,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -9257,7 +9253,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -9279,7 +9274,6 @@ def test_upgrade_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -9301,7 +9295,6 @@ def test_import_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() - assert args[0] == request_msg @@ -9323,7 +9316,6 @@ def test_export_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() - assert args[0] == request_msg @@ -9345,7 +9337,6 @@ def test_failover_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() - assert args[0] == request_msg @@ -9367,7 +9358,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -9389,7 +9379,6 @@ def test_reschedule_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -11226,7 +11215,6 @@ async def test_list_instances_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -11251,7 +11239,6 @@ async def test_get_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -11276,7 +11263,6 @@ async def test_get_instance_auth_string_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() - assert args[0] == request_msg @@ -11301,7 +11287,6 @@ async def test_create_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -11326,7 +11311,6 @@ async def test_update_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -11351,7 +11335,6 @@ async def test_upgrade_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -11376,7 +11359,6 @@ async def test_import_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() - assert args[0] == request_msg @@ -11401,7 +11383,6 @@ async def test_export_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() - assert args[0] == request_msg @@ -11426,7 +11407,6 @@ async def test_failover_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() - assert args[0] == request_msg @@ -11451,7 +11431,6 @@ async def test_delete_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -11476,7 +11455,6 @@ async def test_reschedule_maintenance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py index 68b12483a50b..d29546120e42 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -989,8 +989,10 @@ def test_cloud_redis_client_create_channel_credentials_file(client_class, transp @pytest.mark.parametrize("request_type", [ - cloud_redis.ListInstancesRequest, - dict, + cloud_redis.ListInstancesRequest({ + }), + { + }, ]) def test_list_instances(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1000,7 +1002,7 @@ def test_list_instances(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1049,10 +1051,11 @@ def test_list_instances_non_empty_request_with_auto_populated_field(): client.list_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ListInstancesRequest( + request_msg = cloud_redis.ListInstancesRequest( parent='parent_value', page_token='page_token_value', ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1121,7 +1124,11 @@ async def test_list_instances_async_use_cached_wrapped_rpc(transport: str = "grp assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_instances_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ListInstancesRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.ListInstancesRequest({ }), + { }, +]) +async def test_list_instances_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1129,7 +1136,7 @@ async def test_list_instances_async(transport: str = 'grpc_asyncio', request_typ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1153,11 +1160,6 @@ async def test_list_instances_async(transport: str = 'grpc_asyncio', request_typ assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_instances_async_from_dict(): - await test_list_instances_async(request_type=dict) - def test_list_instances_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1498,8 +1500,10 @@ async def test_list_instances_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - cloud_redis.GetInstanceRequest, - dict, + cloud_redis.GetInstanceRequest({ + }), + { + }, ]) def test_get_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1509,7 +1513,7 @@ def test_get_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1607,9 +1611,10 @@ def test_get_instance_non_empty_request_with_auto_populated_field(): client.get_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceRequest( + request_msg = cloud_redis.GetInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1678,7 +1683,11 @@ async def test_get_instance_async_use_cached_wrapped_rpc(transport: str = "grpc_ assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.GetInstanceRequest({ }), + { }, +]) +async def test_get_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1686,7 +1695,7 @@ async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type= # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1760,11 +1769,6 @@ async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type= assert response.maintenance_version == 'maintenance_version_value' assert response.available_maintenance_versions == ['available_maintenance_versions_value'] - -@pytest.mark.asyncio -async def test_get_instance_async_from_dict(): - await test_get_instance_async(request_type=dict) - def test_get_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1911,8 +1915,10 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.CreateInstanceRequest, - dict, + cloud_redis.CreateInstanceRequest({ + }), + { + }, ]) def test_create_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -1922,7 +1928,7 @@ def test_create_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1966,10 +1972,11 @@ def test_create_instance_non_empty_request_with_auto_populated_field(): client.create_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.CreateInstanceRequest( + request_msg = cloud_redis.CreateInstanceRequest( parent='parent_value', instance_id='instance_id_value', ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2048,7 +2055,11 @@ async def test_create_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.CreateInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.CreateInstanceRequest({ }), + { }, +]) +async def test_create_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2056,7 +2067,7 @@ async def test_create_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2077,11 +2088,6 @@ async def test_create_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_instance_async_from_dict(): - await test_create_instance_async(request_type=dict) - def test_create_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2250,8 +2256,10 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.UpdateInstanceRequest, - dict, + cloud_redis.UpdateInstanceRequest({ + }), + { + }, ]) def test_update_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2261,7 +2269,7 @@ def test_update_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2303,8 +2311,9 @@ def test_update_instance_non_empty_request_with_auto_populated_field(): client.update_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpdateInstanceRequest( + request_msg = cloud_redis.UpdateInstanceRequest( ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2383,7 +2392,11 @@ async def test_update_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_update_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpdateInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.UpdateInstanceRequest({ }), + { }, +]) +async def test_update_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2391,7 +2404,7 @@ async def test_update_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2412,11 +2425,6 @@ async def test_update_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_update_instance_async_from_dict(): - await test_update_instance_async(request_type=dict) - def test_update_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2575,8 +2583,10 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - cloud_redis.DeleteInstanceRequest, - dict, + cloud_redis.DeleteInstanceRequest({ + }), + { + }, ]) def test_delete_instance(request_type, transport: str = 'grpc'): client = CloudRedisClient( @@ -2586,7 +2596,7 @@ def test_delete_instance(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2629,9 +2639,10 @@ def test_delete_instance_non_empty_request_with_auto_populated_field(): client.delete_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.DeleteInstanceRequest( + request_msg = cloud_redis.DeleteInstanceRequest( name='name_value', ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2710,7 +2721,11 @@ async def test_delete_instance_async_use_cached_wrapped_rpc(transport: str = "gr assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.DeleteInstanceRequest): +@pytest.mark.parametrize("request_type", [ + cloud_redis.DeleteInstanceRequest({ }), + { }, +]) +async def test_delete_instance_async(request_type, transport: str = 'grpc_asyncio'): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2718,7 +2733,7 @@ async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_ty # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2739,11 +2754,6 @@ async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_delete_instance_async_from_dict(): - await test_delete_instance_async(request_type=dict) - def test_delete_instance_field_headers(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3921,7 +3931,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -3944,7 +3953,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -3967,7 +3975,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -3990,7 +3997,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -4013,7 +4019,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -4056,7 +4061,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -4109,7 +4113,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -4136,7 +4139,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -4163,7 +4165,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -4190,7 +4191,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5294,7 +5294,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -5316,7 +5315,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -5338,7 +5336,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -5360,7 +5357,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5382,7 +5378,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6566,7 +6561,6 @@ async def test_list_instances_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() - assert args[0] == request_msg @@ -6591,7 +6585,6 @@ async def test_get_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() - assert args[0] == request_msg @@ -6616,7 +6609,6 @@ async def test_create_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() - assert args[0] == request_msg @@ -6641,7 +6633,6 @@ async def test_update_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6666,7 +6657,6 @@ async def test_delete_instance_empty_call_rest_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() - assert args[0] == request_msg diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py index 07263ddfe431..6a8c312c992f 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/async_client.py @@ -621,8 +621,7 @@ async def sample_create_job(): )), ) - if not request.request_id: - request.request_id = str(uuid.uuid4()) + self._client._setup_request_id(request, 'request_id', False) # Validate the universe domain. self._client._validate_universe_domain() @@ -728,8 +727,7 @@ async def sample_delete_job(): )), ) - if not request.request_id: - request.request_id = str(uuid.uuid4()) + self._client._setup_request_id(request, 'request_id', False) # Validate the universe domain. self._client._validate_universe_domain() @@ -831,8 +829,7 @@ async def sample_cancel_job(): )), ) - if not request.request_id: - request.request_id = str(uuid.uuid4()) + self._client._setup_request_id(request, 'request_id', False) # Validate the universe domain. self._client._validate_universe_domain() diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py index 913bc14f0725..628f7cfffc32 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/services/storage_batch_operations/client.py @@ -471,6 +471,36 @@ def _validate_universe_domain(self): # NOTE (b/349488459): universe validation is disabled until further notice. return True + @staticmethod + def _setup_request_id(request, field_name: str, is_proto3_optional: bool): + """Populate a UUID4 field in the request if it is not already set. + + Args: + request (Union[google.protobuf.message.Message, dict]): The request object. + field_name (str): The name of the field to populate. + is_proto3_optional (bool): Whether the field is proto3 optional. + """ + if isinstance(request, dict): + if is_proto3_optional: + if field_name not in request: + request[field_name] = str(uuid.uuid4()) + elif not request.get(field_name): + request[field_name] = str(uuid.uuid4()) + return + + if is_proto3_optional: + try: + # Pure protobuf messages + if not request.HasField(field_name): + setattr(request, field_name, str(uuid.uuid4())) + except (AttributeError, ValueError): + # Proto-plus messages or other objects + if field_name not in request: + setattr(request, field_name, str(uuid.uuid4())) + else: + if not getattr(request, field_name): + setattr(request, field_name, str(uuid.uuid4())) + def _add_cred_info_for_auth_errors( self, error: core_exceptions.GoogleAPICallError @@ -1005,8 +1035,7 @@ def sample_create_job(): )), ) - if not request.request_id: - request.request_id = str(uuid.uuid4()) + self._setup_request_id(request, 'request_id', False) # Validate the universe domain. self._validate_universe_domain() @@ -1111,8 +1140,7 @@ def sample_delete_job(): )), ) - if not request.request_id: - request.request_id = str(uuid.uuid4()) + self._setup_request_id(request, 'request_id', False) # Validate the universe domain. self._validate_universe_domain() @@ -1213,8 +1241,7 @@ def sample_cancel_job(): )), ) - if not request.request_id: - request.request_id = str(uuid.uuid4()) + self._setup_request_id(request, 'request_id', False) # Validate the universe domain. self._validate_universe_domain() diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index 89da1e9ccd16..15d53645f43d 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py @@ -75,6 +75,7 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}") async def mock_async_gen(data, chunk_size=1): @@ -350,6 +351,82 @@ def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): client._add_cred_info_for_auth_errors(error) assert error.details == [] +def test__setup_request_id(): + class MockRequest: + def __init__(self, **kwargs): + for k, v in kwargs.items(): + setattr(self, k, v) + def __contains__(self, key): + return hasattr(self, key) + + class MockProtoRequest: + def __init__(self, **kwargs): + for k, v in kwargs.items(): + setattr(self, k, v) + def HasField(self, key): + return hasattr(self, key) + + # Test with proto3 optional field not in request + request = MockRequest() + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) + + # Test with proto3 optional field already in request + request = MockRequest(request_id="already_set") + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert request.request_id == "already_set" + + # Test with non-proto3 optional field empty + request = MockRequest(request_id="") + StorageBatchOperationsClient._setup_request_id(request, "request_id", False) + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) + + # Test with non-proto3 optional field already set + request = MockRequest(request_id="already_set") + StorageBatchOperationsClient._setup_request_id(request, "request_id", False) + assert request.request_id == "already_set" + + # Test with proto3 optional field not in request (MockProtoRequest) + request = MockProtoRequest() + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) + + # Test with proto3 optional field already in request (MockProtoRequest) + request = MockProtoRequest(request_id="already_set") + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert request.request_id == "already_set" + + # Test with ValueError + class MockValueErrorRequest: + def HasField(self, key): + raise ValueError("Mismatched field") + def __contains__(self, key): + return hasattr(self, key) + + request = MockValueErrorRequest() + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request.request_id) + + # Test with dict and proto3 optional field not in request + request = {} + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request["request_id"]) + + # Test with dict and proto3 optional field already in request + request = {"request_id": "already_set"} + StorageBatchOperationsClient._setup_request_id(request, "request_id", True) + assert request["request_id"] == "already_set" + + # Test with dict and non-proto3 optional field empty + request = {"request_id": ""} + StorageBatchOperationsClient._setup_request_id(request, "request_id", False) + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", request["request_id"]) + + # Test with dict and non-proto3 optional field already set + request = {"request_id": "already_set"} + StorageBatchOperationsClient._setup_request_id(request, "request_id", False) + assert request["request_id"] == "already_set" + @pytest.mark.parametrize("client_class,transport_name", [ (StorageBatchOperationsClient, "grpc"), (StorageBatchOperationsAsyncClient, "grpc_asyncio"), @@ -980,8 +1057,10 @@ def test_storage_batch_operations_client_create_channel_credentials_file(client_ @pytest.mark.parametrize("request_type", [ - storage_batch_operations.ListJobsRequest, - dict, + storage_batch_operations.ListJobsRequest({ + }), + { + }, ]) def test_list_jobs(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -991,7 +1070,7 @@ def test_list_jobs(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1042,12 +1121,13 @@ def test_list_jobs_non_empty_request_with_auto_populated_field(): client.list_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.ListJobsRequest( + request_msg = storage_batch_operations.ListJobsRequest( parent='parent_value', filter='filter_value', page_token='page_token_value', order_by='order_by_value', ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1116,7 +1196,11 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_jobs_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.ListJobsRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.ListJobsRequest({ }), + { }, +]) +async def test_list_jobs_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1124,7 +1208,7 @@ async def test_list_jobs_async(transport: str = 'grpc_asyncio', request_type=sto # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1148,11 +1232,6 @@ async def test_list_jobs_async(transport: str = 'grpc_asyncio', request_type=sto assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_jobs_async_from_dict(): - await test_list_jobs_async(request_type=dict) - def test_list_jobs_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1493,8 +1572,10 @@ async def test_list_jobs_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - storage_batch_operations.GetJobRequest, - dict, + storage_batch_operations.GetJobRequest({ + }), + { + }, ]) def test_get_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -1504,7 +1585,7 @@ def test_get_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1558,9 +1639,10 @@ def test_get_job_non_empty_request_with_auto_populated_field(): client.get_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.GetJobRequest( + request_msg = storage_batch_operations.GetJobRequest( name='name_value', ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1629,7 +1711,11 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.GetJobRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.GetJobRequest({ }), + { }, +]) +async def test_get_job_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1637,7 +1723,7 @@ async def test_get_job_async(transport: str = 'grpc_asyncio', request_type=stora # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1667,11 +1753,6 @@ async def test_get_job_async(transport: str = 'grpc_asyncio', request_type=stora assert response.dry_run is True assert response.is_multi_bucket_job is True - -@pytest.mark.asyncio -async def test_get_job_async_from_dict(): - await test_get_job_async(request_type=dict) - def test_get_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1818,8 +1899,12 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.CreateJobRequest, - dict, + storage_batch_operations.CreateJobRequest({ + "request_id": "explicit value for autopopulate-able field", + }), + { + "request_id": "explicit value for autopopulate-able field", + }, ]) def test_create_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -1829,11 +1914,7 @@ def test_create_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - if isinstance(request, dict): - request['request_id'] = "explicit value for autopopulate-able field" - else: - request.request_id = "explicit value for autopopulate-able field" + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1878,14 +1959,14 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None - assert args[0] == storage_batch_operations.CreateJobRequest( + request_msg = storage_batch_operations.CreateJobRequest( parent='parent_value', job_id='job_id_value', ) + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -1964,7 +2045,11 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_create_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.CreateJobRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.CreateJobRequest({ "request_id": "explicit value for autopopulate-able field", }), + { "request_id": "explicit value for autopopulate-able field", }, +]) +async def test_create_job_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1972,11 +2057,7 @@ async def test_create_job_async(transport: str = 'grpc_asyncio', request_type=st # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - if isinstance(request, dict): - request['request_id'] = "explicit value for autopopulate-able field" - else: - request.request_id = "explicit value for autopopulate-able field" + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1998,11 +2079,6 @@ async def test_create_job_async(transport: str = 'grpc_asyncio', request_type=st # Establish that the response is the type that we expect. assert isinstance(response, future.Future) - -@pytest.mark.asyncio -async def test_create_job_async_from_dict(): - await test_create_job_async(request_type=dict) - def test_create_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2171,8 +2247,12 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.DeleteJobRequest, - dict, + storage_batch_operations.DeleteJobRequest({ + "request_id": "explicit value for autopopulate-able field", + }), + { + "request_id": "explicit value for autopopulate-able field", + }, ]) def test_delete_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -2182,11 +2262,7 @@ def test_delete_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - if isinstance(request, dict): - request['request_id'] = "explicit value for autopopulate-able field" - else: - request.request_id = "explicit value for autopopulate-able field" + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2230,13 +2306,13 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None - assert args[0] == storage_batch_operations.DeleteJobRequest( + request_msg = storage_batch_operations.DeleteJobRequest( name='name_value', ) + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2305,7 +2381,11 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_delete_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.DeleteJobRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.DeleteJobRequest({ "request_id": "explicit value for autopopulate-able field", }), + { "request_id": "explicit value for autopopulate-able field", }, +]) +async def test_delete_job_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2313,11 +2393,7 @@ async def test_delete_job_async(transport: str = 'grpc_asyncio', request_type=st # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - if isinstance(request, dict): - request['request_id'] = "explicit value for autopopulate-able field" - else: - request.request_id = "explicit value for autopopulate-able field" + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2337,11 +2413,6 @@ async def test_delete_job_async(transport: str = 'grpc_asyncio', request_type=st # Establish that the response is the type that we expect. assert response is None - -@pytest.mark.asyncio -async def test_delete_job_async_from_dict(): - await test_delete_job_async(request_type=dict) - def test_delete_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2488,8 +2559,12 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.CancelJobRequest, - dict, + storage_batch_operations.CancelJobRequest({ + "request_id": "explicit value for autopopulate-able field", + }), + { + "request_id": "explicit value for autopopulate-able field", + }, ]) def test_cancel_job(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -2499,11 +2574,7 @@ def test_cancel_job(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - if isinstance(request, dict): - request['request_id'] = "explicit value for autopopulate-able field" - else: - request.request_id = "explicit value for autopopulate-able field" + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2548,13 +2619,13 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None - assert args[0] == storage_batch_operations.CancelJobRequest( + request_msg = storage_batch_operations.CancelJobRequest( name='name_value', ) + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id + assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2623,7 +2694,11 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_cancel_job_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.CancelJobRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.CancelJobRequest({ "request_id": "explicit value for autopopulate-able field", }), + { "request_id": "explicit value for autopopulate-able field", }, +]) +async def test_cancel_job_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2631,11 +2706,7 @@ async def test_cancel_job_async(transport: str = 'grpc_asyncio', request_type=st # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() - if isinstance(request, dict): - request['request_id'] = "explicit value for autopopulate-able field" - else: - request.request_id = "explicit value for autopopulate-able field" + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2656,11 +2727,6 @@ async def test_cancel_job_async(transport: str = 'grpc_asyncio', request_type=st # Establish that the response is the type that we expect. assert isinstance(response, storage_batch_operations.CancelJobResponse) - -@pytest.mark.asyncio -async def test_cancel_job_async_from_dict(): - await test_cancel_job_async(request_type=dict) - def test_cancel_job_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2807,8 +2873,10 @@ async def test_cancel_job_flattened_error_async(): @pytest.mark.parametrize("request_type", [ - storage_batch_operations.ListBucketOperationsRequest, - dict, + storage_batch_operations.ListBucketOperationsRequest({ + }), + { + }, ]) def test_list_bucket_operations(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -2818,7 +2886,7 @@ def test_list_bucket_operations(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2869,12 +2937,13 @@ def test_list_bucket_operations_non_empty_request_with_auto_populated_field(): client.list_bucket_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.ListBucketOperationsRequest( + request_msg = storage_batch_operations.ListBucketOperationsRequest( parent='parent_value', filter='filter_value', page_token='page_token_value', order_by='order_by_value', ) + assert args[0] == request_msg def test_list_bucket_operations_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -2943,7 +3012,11 @@ async def test_list_bucket_operations_async_use_cached_wrapped_rpc(transport: st assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_list_bucket_operations_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.ListBucketOperationsRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.ListBucketOperationsRequest({ }), + { }, +]) +async def test_list_bucket_operations_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2951,7 +3024,7 @@ async def test_list_bucket_operations_async(transport: str = 'grpc_asyncio', req # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2975,11 +3048,6 @@ async def test_list_bucket_operations_async(transport: str = 'grpc_asyncio', req assert response.next_page_token == 'next_page_token_value' assert response.unreachable == ['unreachable_value'] - -@pytest.mark.asyncio -async def test_list_bucket_operations_async_from_dict(): - await test_list_bucket_operations_async(request_type=dict) - def test_list_bucket_operations_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3320,8 +3388,10 @@ async def test_list_bucket_operations_async_pages(): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize("request_type", [ - storage_batch_operations.GetBucketOperationRequest, - dict, + storage_batch_operations.GetBucketOperationRequest({ + }), + { + }, ]) def test_get_bucket_operation(request_type, transport: str = 'grpc'): client = StorageBatchOperationsClient( @@ -3331,7 +3401,7 @@ def test_get_bucket_operation(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3381,9 +3451,10 @@ def test_get_bucket_operation_non_empty_request_with_auto_populated_field(): client.get_bucket_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.GetBucketOperationRequest( + request_msg = storage_batch_operations.GetBucketOperationRequest( name='name_value', ) + assert args[0] == request_msg def test_get_bucket_operation_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, @@ -3452,7 +3523,11 @@ async def test_get_bucket_operation_async_use_cached_wrapped_rpc(transport: str assert mock_rpc.call_count == 2 @pytest.mark.asyncio -async def test_get_bucket_operation_async(transport: str = 'grpc_asyncio', request_type=storage_batch_operations.GetBucketOperationRequest): +@pytest.mark.parametrize("request_type", [ + storage_batch_operations.GetBucketOperationRequest({ }), + { }, +]) +async def test_get_bucket_operation_async(request_type, transport: str = 'grpc_asyncio'): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3460,7 +3535,7 @@ async def test_get_bucket_operation_async(transport: str = 'grpc_asyncio', reque # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3486,11 +3561,6 @@ async def test_get_bucket_operation_async(transport: str = 'grpc_asyncio', reque assert response.bucket_name == 'bucket_name_value' assert response.state == storage_batch_operations_types.BucketOperation.State.QUEUED - -@pytest.mark.asyncio -async def test_get_bucket_operation_async_from_dict(): - await test_get_bucket_operation_async(request_type=dict) - def test_get_bucket_operation_field_headers(): client = StorageBatchOperationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4151,7 +4221,7 @@ def test_create_job_rest_required_fields(request_type=storage_batch_operations.C # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) + assert _UUID4_RE.match(value) break # Include requestId within expected_params with value mock.ANY @@ -4329,7 +4399,7 @@ def test_delete_job_rest_required_fields(request_type=storage_batch_operations.D # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) + assert _UUID4_RE.match(value) break # Include requestId within expected_params with value mock.ANY @@ -4505,7 +4575,7 @@ def test_cancel_job_rest_required_fields(request_type=storage_batch_operations.C # Ensure that the uuid4 field is set according to AIP 4235 for i, (key, value) in enumerate(req.call_args.kwargs['params']): if key == "requestId": - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", value) + assert _UUID4_RE.match(value) break # Include requestId within expected_params with value mock.ANY @@ -5095,7 +5165,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListJobsRequest() - assert args[0] == request_msg @@ -5118,7 +5187,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetJobRequest() - assert args[0] == request_msg @@ -5140,12 +5208,10 @@ def test_create_job_empty_call_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.CreateJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -5167,12 +5233,10 @@ def test_delete_job_empty_call_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.DeleteJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -5194,12 +5258,10 @@ def test_cancel_job_empty_call_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.CancelJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -5222,7 +5284,6 @@ def test_list_bucket_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListBucketOperationsRequest() - assert args[0] == request_msg @@ -5245,7 +5306,6 @@ def test_get_bucket_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetBucketOperationRequest() - assert args[0] == request_msg @@ -5288,7 +5348,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListJobsRequest() - assert args[0] == request_msg @@ -5319,7 +5378,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetJobRequest() - assert args[0] == request_msg @@ -5345,12 +5403,10 @@ async def test_create_job_empty_call_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.CreateJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -5374,12 +5430,10 @@ async def test_delete_job_empty_call_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.DeleteJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -5404,12 +5458,10 @@ async def test_cancel_job_empty_call_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.CancelJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -5437,7 +5489,6 @@ async def test_list_bucket_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListBucketOperationsRequest() - assert args[0] == request_msg @@ -5466,7 +5517,6 @@ async def test_get_bucket_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetBucketOperationRequest() - assert args[0] == request_msg @@ -6619,7 +6669,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListJobsRequest() - assert args[0] == request_msg @@ -6641,7 +6690,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetJobRequest() - assert args[0] == request_msg @@ -6662,12 +6710,10 @@ def test_create_job_empty_call_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.CreateJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -6688,12 +6734,10 @@ def test_delete_job_empty_call_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.DeleteJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -6714,12 +6758,10 @@ def test_cancel_job_empty_call_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] - # Ensure that the uuid4 field is set according to AIP 4235 - assert re.fullmatch(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].request_id) - # clear UUID field so that the check below succeeds - args[0].request_id = None request_msg = storage_batch_operations.CancelJobRequest() - + # Ensure that the uuid4 field is set according to AIP 4235 + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id assert args[0] == request_msg @@ -6741,7 +6783,6 @@ def test_list_bucket_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.ListBucketOperationsRequest() - assert args[0] == request_msg @@ -6763,7 +6804,6 @@ def test_get_bucket_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.GetBucketOperationRequest() - assert args[0] == request_msg From fe718c0bc4b94b0c8d17f1bab39297f1f78d26c3 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 05:43:09 -0400 Subject: [PATCH 23/28] refactor(logging): regenerate logging library with latest generator and sync constraints lower bounds --- .../testing/constraints-3.10.txt | 15 +- .../logging_v2/test_config_service_v2.py | 930 +++++++++--------- .../logging_v2/test_logging_service_v2.py | 171 ++-- .../logging_v2/test_metrics_service_v2.py | 148 ++- .../lower_bound_checker.py | 2 +- 5 files changed, 618 insertions(+), 648 deletions(-) diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index 7be9c36933fc..90f4a9bf003d 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -1,11 +1,12 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file, -# pinning their versions to their lower bounds. -# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", -# then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 +google-cloud-appengine-logging==0.1.3 +google-cloud-audit-log==0.3.1 +google-cloud-core==2.0.0 +grpc-google-iam-v1==0.12.4 +grpcio==1.75.1 grpcio==1.59.0 +opentelemetry-api==1.16.0 +proto-plus==1.25.0 proto-plus==1.22.3 -protobuf==4.25.8 +protobuf==4.25.8 \ No newline at end of file diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index f4800c87b39d..f5ad9afa69ca 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -71,6 +71,9 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" +) async def mock_async_gen(data, chunk_size=1): @@ -1333,8 +1336,8 @@ def test_config_service_v2_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - logging_config.ListBucketsRequest, - dict, + logging_config.ListBucketsRequest({}), + {}, ], ) def test_list_buckets(request_type, transport: str = "grpc"): @@ -1345,7 +1348,7 @@ def test_list_buckets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_buckets), "__call__") as call: @@ -1390,10 +1393,11 @@ def test_list_buckets_non_empty_request_with_auto_populated_field(): client.list_buckets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListBucketsRequest( + request_msg = logging_config.ListBucketsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_buckets_use_cached_wrapped_rpc(): @@ -1474,9 +1478,14 @@ async def test_list_buckets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_buckets_async( - transport: str = "grpc_asyncio", request_type=logging_config.ListBucketsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.ListBucketsRequest({}), + {}, + ], +) +async def test_list_buckets_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1484,7 +1493,7 @@ async def test_list_buckets_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_buckets), "__call__") as call: @@ -1507,11 +1516,6 @@ async def test_list_buckets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_buckets_async_from_dict(): - await test_list_buckets_async(request_type=dict) - - def test_list_buckets_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1848,8 +1852,8 @@ async def test_list_buckets_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetBucketRequest, - dict, + logging_config.GetBucketRequest({}), + {}, ], ) def test_get_bucket(request_type, transport: str = "grpc"): @@ -1860,7 +1864,7 @@ def test_get_bucket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_bucket), "__call__") as call: @@ -1916,9 +1920,10 @@ def test_get_bucket_non_empty_request_with_auto_populated_field(): client.get_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetBucketRequest( + request_msg = logging_config.GetBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_get_bucket_use_cached_wrapped_rpc(): @@ -1997,9 +2002,14 @@ async def test_get_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_bucket_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetBucketRequest({}), + {}, + ], +) +async def test_get_bucket_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2007,7 +2017,7 @@ async def test_get_bucket_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_bucket), "__call__") as call: @@ -2042,11 +2052,6 @@ async def test_get_bucket_async( assert response.restricted_fields == ["restricted_fields_value"] -@pytest.mark.asyncio -async def test_get_bucket_async_from_dict(): - await test_get_bucket_async(request_type=dict) - - def test_get_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2116,8 @@ async def test_get_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateBucketRequest, - dict, + logging_config.CreateBucketRequest({}), + {}, ], ) def test_create_bucket_async(request_type, transport: str = "grpc"): @@ -2123,7 +2128,7 @@ def test_create_bucket_async(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2169,10 +2174,11 @@ def test_create_bucket_async_non_empty_request_with_auto_populated_field(): client.create_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest( + request_msg = logging_config.CreateBucketRequest( parent="parent_value", bucket_id="bucket_id_value", ) + assert args[0] == request_msg def test_create_bucket_async_use_cached_wrapped_rpc(): @@ -2267,9 +2273,14 @@ async def test_create_bucket_async_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_bucket_async_async( - transport: str = "grpc_asyncio", request_type=logging_config.CreateBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CreateBucketRequest({}), + {}, + ], +) +async def test_create_bucket_async_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2277,7 +2288,7 @@ async def test_create_bucket_async_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2299,11 +2310,6 @@ async def test_create_bucket_async_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_bucket_async_async_from_dict(): - await test_create_bucket_async_async(request_type=dict) - - def test_create_bucket_async_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2372,8 +2378,8 @@ async def test_create_bucket_async_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateBucketRequest, - dict, + logging_config.UpdateBucketRequest({}), + {}, ], ) def test_update_bucket_async(request_type, transport: str = "grpc"): @@ -2384,7 +2390,7 @@ def test_update_bucket_async(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2429,9 +2435,10 @@ def test_update_bucket_async_non_empty_request_with_auto_populated_field(): client.update_bucket_async(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest( + request_msg = logging_config.UpdateBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_update_bucket_async_use_cached_wrapped_rpc(): @@ -2526,9 +2533,14 @@ async def test_update_bucket_async_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_bucket_async_async( - transport: str = "grpc_asyncio", request_type=logging_config.UpdateBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateBucketRequest({}), + {}, + ], +) +async def test_update_bucket_async_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2536,7 +2548,7 @@ async def test_update_bucket_async_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2558,11 +2570,6 @@ async def test_update_bucket_async_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_bucket_async_async_from_dict(): - await test_update_bucket_async_async(request_type=dict) - - def test_update_bucket_async_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2631,8 +2638,8 @@ async def test_update_bucket_async_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateBucketRequest, - dict, + logging_config.CreateBucketRequest({}), + {}, ], ) def test_create_bucket(request_type, transport: str = "grpc"): @@ -2643,7 +2650,7 @@ def test_create_bucket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_bucket), "__call__") as call: @@ -2700,10 +2707,11 @@ def test_create_bucket_non_empty_request_with_auto_populated_field(): client.create_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest( + request_msg = logging_config.CreateBucketRequest( parent="parent_value", bucket_id="bucket_id_value", ) + assert args[0] == request_msg def test_create_bucket_use_cached_wrapped_rpc(): @@ -2784,9 +2792,14 @@ async def test_create_bucket_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_bucket_async( - transport: str = "grpc_asyncio", request_type=logging_config.CreateBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CreateBucketRequest({}), + {}, + ], +) +async def test_create_bucket_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2794,7 +2807,7 @@ async def test_create_bucket_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_bucket), "__call__") as call: @@ -2829,11 +2842,6 @@ async def test_create_bucket_async( assert response.restricted_fields == ["restricted_fields_value"] -@pytest.mark.asyncio -async def test_create_bucket_async_from_dict(): - await test_create_bucket_async(request_type=dict) - - def test_create_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2898,8 +2906,8 @@ async def test_create_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateBucketRequest, - dict, + logging_config.UpdateBucketRequest({}), + {}, ], ) def test_update_bucket(request_type, transport: str = "grpc"): @@ -2910,7 +2918,7 @@ def test_update_bucket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_bucket), "__call__") as call: @@ -2966,9 +2974,10 @@ def test_update_bucket_non_empty_request_with_auto_populated_field(): client.update_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest( + request_msg = logging_config.UpdateBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_update_bucket_use_cached_wrapped_rpc(): @@ -3049,9 +3058,14 @@ async def test_update_bucket_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_bucket_async( - transport: str = "grpc_asyncio", request_type=logging_config.UpdateBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateBucketRequest({}), + {}, + ], +) +async def test_update_bucket_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3059,7 +3073,7 @@ async def test_update_bucket_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_bucket), "__call__") as call: @@ -3094,11 +3108,6 @@ async def test_update_bucket_async( assert response.restricted_fields == ["restricted_fields_value"] -@pytest.mark.asyncio -async def test_update_bucket_async_from_dict(): - await test_update_bucket_async(request_type=dict) - - def test_update_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3163,8 +3172,8 @@ async def test_update_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteBucketRequest, - dict, + logging_config.DeleteBucketRequest({}), + {}, ], ) def test_delete_bucket(request_type, transport: str = "grpc"): @@ -3175,7 +3184,7 @@ def test_delete_bucket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_bucket), "__call__") as call: @@ -3216,9 +3225,10 @@ def test_delete_bucket_non_empty_request_with_auto_populated_field(): client.delete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteBucketRequest( + request_msg = logging_config.DeleteBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_bucket_use_cached_wrapped_rpc(): @@ -3299,9 +3309,14 @@ async def test_delete_bucket_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_bucket_async( - transport: str = "grpc_asyncio", request_type=logging_config.DeleteBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.DeleteBucketRequest({}), + {}, + ], +) +async def test_delete_bucket_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3309,7 +3324,7 @@ async def test_delete_bucket_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_bucket), "__call__") as call: @@ -3327,11 +3342,6 @@ async def test_delete_bucket_async( assert response is None -@pytest.mark.asyncio -async def test_delete_bucket_async_from_dict(): - await test_delete_bucket_async(request_type=dict) - - def test_delete_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3394,8 +3404,8 @@ async def test_delete_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UndeleteBucketRequest, - dict, + logging_config.UndeleteBucketRequest({}), + {}, ], ) def test_undelete_bucket(request_type, transport: str = "grpc"): @@ -3406,7 +3416,7 @@ def test_undelete_bucket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.undelete_bucket), "__call__") as call: @@ -3447,9 +3457,10 @@ def test_undelete_bucket_non_empty_request_with_auto_populated_field(): client.undelete_bucket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UndeleteBucketRequest( + request_msg = logging_config.UndeleteBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_bucket_use_cached_wrapped_rpc(): @@ -3530,9 +3541,14 @@ async def test_undelete_bucket_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_bucket_async( - transport: str = "grpc_asyncio", request_type=logging_config.UndeleteBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UndeleteBucketRequest({}), + {}, + ], +) +async def test_undelete_bucket_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3540,7 +3556,7 @@ async def test_undelete_bucket_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.undelete_bucket), "__call__") as call: @@ -3558,11 +3574,6 @@ async def test_undelete_bucket_async( assert response is None -@pytest.mark.asyncio -async def test_undelete_bucket_async_from_dict(): - await test_undelete_bucket_async(request_type=dict) - - def test_undelete_bucket_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3625,8 +3636,8 @@ async def test_undelete_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListViewsRequest, - dict, + logging_config.ListViewsRequest({}), + {}, ], ) def test_list_views(request_type, transport: str = "grpc"): @@ -3637,7 +3648,7 @@ def test_list_views(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_views), "__call__") as call: @@ -3682,10 +3693,11 @@ def test_list_views_non_empty_request_with_auto_populated_field(): client.list_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListViewsRequest( + request_msg = logging_config.ListViewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_views_use_cached_wrapped_rpc(): @@ -3764,9 +3776,14 @@ async def test_list_views_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_views_async( - transport: str = "grpc_asyncio", request_type=logging_config.ListViewsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.ListViewsRequest({}), + {}, + ], +) +async def test_list_views_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3774,7 +3791,7 @@ async def test_list_views_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_views), "__call__") as call: @@ -3797,11 +3814,6 @@ async def test_list_views_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_views_async_from_dict(): - await test_list_views_async(request_type=dict) - - def test_list_views_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4138,8 +4150,8 @@ async def test_list_views_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetViewRequest, - dict, + logging_config.GetViewRequest({}), + {}, ], ) def test_get_view(request_type, transport: str = "grpc"): @@ -4150,7 +4162,7 @@ def test_get_view(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_view), "__call__") as call: @@ -4198,9 +4210,10 @@ def test_get_view_non_empty_request_with_auto_populated_field(): client.get_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetViewRequest( + request_msg = logging_config.GetViewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_view_use_cached_wrapped_rpc(): @@ -4279,9 +4292,14 @@ async def test_get_view_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_view_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetViewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetViewRequest({}), + {}, + ], +) +async def test_get_view_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4289,7 +4307,7 @@ async def test_get_view_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_view), "__call__") as call: @@ -4316,11 +4334,6 @@ async def test_get_view_async( assert response.filter == "filter_value" -@pytest.mark.asyncio -async def test_get_view_async_from_dict(): - await test_get_view_async(request_type=dict) - - def test_get_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4385,8 +4398,8 @@ async def test_get_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateViewRequest, - dict, + logging_config.CreateViewRequest({}), + {}, ], ) def test_create_view(request_type, transport: str = "grpc"): @@ -4397,7 +4410,7 @@ def test_create_view(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_view), "__call__") as call: @@ -4446,10 +4459,11 @@ def test_create_view_non_empty_request_with_auto_populated_field(): client.create_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateViewRequest( + request_msg = logging_config.CreateViewRequest( parent="parent_value", view_id="view_id_value", ) + assert args[0] == request_msg def test_create_view_use_cached_wrapped_rpc(): @@ -4530,9 +4544,14 @@ async def test_create_view_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_view_async( - transport: str = "grpc_asyncio", request_type=logging_config.CreateViewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CreateViewRequest({}), + {}, + ], +) +async def test_create_view_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4540,7 +4559,7 @@ async def test_create_view_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_view), "__call__") as call: @@ -4567,11 +4586,6 @@ async def test_create_view_async( assert response.filter == "filter_value" -@pytest.mark.asyncio -async def test_create_view_async_from_dict(): - await test_create_view_async(request_type=dict) - - def test_create_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4636,8 +4650,8 @@ async def test_create_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateViewRequest, - dict, + logging_config.UpdateViewRequest({}), + {}, ], ) def test_update_view(request_type, transport: str = "grpc"): @@ -4648,7 +4662,7 @@ def test_update_view(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_view), "__call__") as call: @@ -4696,9 +4710,10 @@ def test_update_view_non_empty_request_with_auto_populated_field(): client.update_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateViewRequest( + request_msg = logging_config.UpdateViewRequest( name="name_value", ) + assert args[0] == request_msg def test_update_view_use_cached_wrapped_rpc(): @@ -4779,9 +4794,14 @@ async def test_update_view_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_view_async( - transport: str = "grpc_asyncio", request_type=logging_config.UpdateViewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateViewRequest({}), + {}, + ], +) +async def test_update_view_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4789,7 +4809,7 @@ async def test_update_view_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_view), "__call__") as call: @@ -4816,11 +4836,6 @@ async def test_update_view_async( assert response.filter == "filter_value" -@pytest.mark.asyncio -async def test_update_view_async_from_dict(): - await test_update_view_async(request_type=dict) - - def test_update_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4885,8 +4900,8 @@ async def test_update_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteViewRequest, - dict, + logging_config.DeleteViewRequest({}), + {}, ], ) def test_delete_view(request_type, transport: str = "grpc"): @@ -4897,7 +4912,7 @@ def test_delete_view(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_view), "__call__") as call: @@ -4938,9 +4953,10 @@ def test_delete_view_non_empty_request_with_auto_populated_field(): client.delete_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteViewRequest( + request_msg = logging_config.DeleteViewRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_view_use_cached_wrapped_rpc(): @@ -5021,9 +5037,14 @@ async def test_delete_view_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_view_async( - transport: str = "grpc_asyncio", request_type=logging_config.DeleteViewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.DeleteViewRequest({}), + {}, + ], +) +async def test_delete_view_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5031,7 +5052,7 @@ async def test_delete_view_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_view), "__call__") as call: @@ -5049,11 +5070,6 @@ async def test_delete_view_async( assert response is None -@pytest.mark.asyncio -async def test_delete_view_async_from_dict(): - await test_delete_view_async(request_type=dict) - - def test_delete_view_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5116,8 +5132,8 @@ async def test_delete_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListSinksRequest, - dict, + logging_config.ListSinksRequest({}), + {}, ], ) def test_list_sinks(request_type, transport: str = "grpc"): @@ -5128,7 +5144,7 @@ def test_list_sinks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_sinks), "__call__") as call: @@ -5173,10 +5189,11 @@ def test_list_sinks_non_empty_request_with_auto_populated_field(): client.list_sinks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListSinksRequest( + request_msg = logging_config.ListSinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sinks_use_cached_wrapped_rpc(): @@ -5255,9 +5272,14 @@ async def test_list_sinks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_sinks_async( - transport: str = "grpc_asyncio", request_type=logging_config.ListSinksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.ListSinksRequest({}), + {}, + ], +) +async def test_list_sinks_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5265,7 +5287,7 @@ async def test_list_sinks_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_sinks), "__call__") as call: @@ -5288,11 +5310,6 @@ async def test_list_sinks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sinks_async_from_dict(): - await test_list_sinks_async(request_type=dict) - - def test_list_sinks_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5629,8 +5646,8 @@ async def test_list_sinks_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetSinkRequest, - dict, + logging_config.GetSinkRequest({}), + {}, ], ) def test_get_sink(request_type, transport: str = "grpc"): @@ -5641,7 +5658,7 @@ def test_get_sink(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_sink), "__call__") as call: @@ -5699,9 +5716,10 @@ def test_get_sink_non_empty_request_with_auto_populated_field(): client.get_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSinkRequest( + request_msg = logging_config.GetSinkRequest( sink_name="sink_name_value", ) + assert args[0] == request_msg def test_get_sink_use_cached_wrapped_rpc(): @@ -5780,9 +5798,14 @@ async def test_get_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_sink_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetSinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetSinkRequest({}), + {}, + ], +) +async def test_get_sink_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5790,7 +5813,7 @@ async def test_get_sink_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_sink), "__call__") as call: @@ -5827,11 +5850,6 @@ async def test_get_sink_async( assert response.include_children is True -@pytest.mark.asyncio -async def test_get_sink_async_from_dict(): - await test_get_sink_async(request_type=dict) - - def test_get_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5978,8 +5996,8 @@ async def test_get_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateSinkRequest, - dict, + logging_config.CreateSinkRequest({}), + {}, ], ) def test_create_sink(request_type, transport: str = "grpc"): @@ -5990,7 +6008,7 @@ def test_create_sink(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_sink), "__call__") as call: @@ -6048,9 +6066,10 @@ def test_create_sink_non_empty_request_with_auto_populated_field(): client.create_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateSinkRequest( + request_msg = logging_config.CreateSinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_sink_use_cached_wrapped_rpc(): @@ -6131,9 +6150,14 @@ async def test_create_sink_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sink_async( - transport: str = "grpc_asyncio", request_type=logging_config.CreateSinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CreateSinkRequest({}), + {}, + ], +) +async def test_create_sink_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6141,7 +6165,7 @@ async def test_create_sink_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_sink), "__call__") as call: @@ -6178,11 +6202,6 @@ async def test_create_sink_async( assert response.include_children is True -@pytest.mark.asyncio -async def test_create_sink_async_from_dict(): - await test_create_sink_async(request_type=dict) - - def test_create_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6339,8 +6358,8 @@ async def test_create_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateSinkRequest, - dict, + logging_config.UpdateSinkRequest({}), + {}, ], ) def test_update_sink(request_type, transport: str = "grpc"): @@ -6351,7 +6370,7 @@ def test_update_sink(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_sink), "__call__") as call: @@ -6409,9 +6428,10 @@ def test_update_sink_non_empty_request_with_auto_populated_field(): client.update_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSinkRequest( + request_msg = logging_config.UpdateSinkRequest( sink_name="sink_name_value", ) + assert args[0] == request_msg def test_update_sink_use_cached_wrapped_rpc(): @@ -6492,9 +6512,14 @@ async def test_update_sink_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_sink_async( - transport: str = "grpc_asyncio", request_type=logging_config.UpdateSinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateSinkRequest({}), + {}, + ], +) +async def test_update_sink_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6502,7 +6527,7 @@ async def test_update_sink_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_sink), "__call__") as call: @@ -6539,11 +6564,6 @@ async def test_update_sink_async( assert response.include_children is True -@pytest.mark.asyncio -async def test_update_sink_async_from_dict(): - await test_update_sink_async(request_type=dict) - - def test_update_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -6710,8 +6730,8 @@ async def test_update_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteSinkRequest, - dict, + logging_config.DeleteSinkRequest({}), + {}, ], ) def test_delete_sink(request_type, transport: str = "grpc"): @@ -6722,7 +6742,7 @@ def test_delete_sink(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_sink), "__call__") as call: @@ -6763,9 +6783,10 @@ def test_delete_sink_non_empty_request_with_auto_populated_field(): client.delete_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteSinkRequest( + request_msg = logging_config.DeleteSinkRequest( sink_name="sink_name_value", ) + assert args[0] == request_msg def test_delete_sink_use_cached_wrapped_rpc(): @@ -6846,9 +6867,14 @@ async def test_delete_sink_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sink_async( - transport: str = "grpc_asyncio", request_type=logging_config.DeleteSinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.DeleteSinkRequest({}), + {}, + ], +) +async def test_delete_sink_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6856,7 +6882,7 @@ async def test_delete_sink_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_sink), "__call__") as call: @@ -6874,11 +6900,6 @@ async def test_delete_sink_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sink_async_from_dict(): - await test_delete_sink_async(request_type=dict) - - def test_delete_sink_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7021,8 +7042,8 @@ async def test_delete_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateLinkRequest, - dict, + logging_config.CreateLinkRequest({}), + {}, ], ) def test_create_link(request_type, transport: str = "grpc"): @@ -7033,7 +7054,7 @@ def test_create_link(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_link), "__call__") as call: @@ -7075,10 +7096,11 @@ def test_create_link_non_empty_request_with_auto_populated_field(): client.create_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateLinkRequest( + request_msg = logging_config.CreateLinkRequest( parent="parent_value", link_id="link_id_value", ) + assert args[0] == request_msg def test_create_link_use_cached_wrapped_rpc(): @@ -7169,9 +7191,14 @@ async def test_create_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_link_async( - transport: str = "grpc_asyncio", request_type=logging_config.CreateLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CreateLinkRequest({}), + {}, + ], +) +async def test_create_link_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7179,7 +7206,7 @@ async def test_create_link_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_link), "__call__") as call: @@ -7199,11 +7226,6 @@ async def test_create_link_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_link_async_from_dict(): - await test_create_link_async(request_type=dict) - - def test_create_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7370,8 +7392,8 @@ async def test_create_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteLinkRequest, - dict, + logging_config.DeleteLinkRequest({}), + {}, ], ) def test_delete_link(request_type, transport: str = "grpc"): @@ -7382,7 +7404,7 @@ def test_delete_link(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_link), "__call__") as call: @@ -7423,9 +7445,10 @@ def test_delete_link_non_empty_request_with_auto_populated_field(): client.delete_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteLinkRequest( + request_msg = logging_config.DeleteLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_link_use_cached_wrapped_rpc(): @@ -7516,9 +7539,14 @@ async def test_delete_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_link_async( - transport: str = "grpc_asyncio", request_type=logging_config.DeleteLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.DeleteLinkRequest({}), + {}, + ], +) +async def test_delete_link_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7526,7 +7554,7 @@ async def test_delete_link_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_link), "__call__") as call: @@ -7546,11 +7574,6 @@ async def test_delete_link_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_link_async_from_dict(): - await test_delete_link_async(request_type=dict) - - def test_delete_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -7697,8 +7720,8 @@ async def test_delete_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListLinksRequest, - dict, + logging_config.ListLinksRequest({}), + {}, ], ) def test_list_links(request_type, transport: str = "grpc"): @@ -7709,7 +7732,7 @@ def test_list_links(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_links), "__call__") as call: @@ -7754,10 +7777,11 @@ def test_list_links_non_empty_request_with_auto_populated_field(): client.list_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListLinksRequest( + request_msg = logging_config.ListLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_links_use_cached_wrapped_rpc(): @@ -7836,9 +7860,14 @@ async def test_list_links_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_links_async( - transport: str = "grpc_asyncio", request_type=logging_config.ListLinksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.ListLinksRequest({}), + {}, + ], +) +async def test_list_links_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7846,7 +7875,7 @@ async def test_list_links_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_links), "__call__") as call: @@ -7869,11 +7898,6 @@ async def test_list_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_links_async_from_dict(): - await test_list_links_async(request_type=dict) - - def test_list_links_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8210,8 +8234,8 @@ async def test_list_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetLinkRequest, - dict, + logging_config.GetLinkRequest({}), + {}, ], ) def test_get_link(request_type, transport: str = "grpc"): @@ -8222,7 +8246,7 @@ def test_get_link(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_link), "__call__") as call: @@ -8270,9 +8294,10 @@ def test_get_link_non_empty_request_with_auto_populated_field(): client.get_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetLinkRequest( + request_msg = logging_config.GetLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_link_use_cached_wrapped_rpc(): @@ -8351,9 +8376,14 @@ async def test_get_link_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_link_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetLinkRequest({}), + {}, + ], +) +async def test_get_link_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8361,7 +8391,7 @@ async def test_get_link_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_link), "__call__") as call: @@ -8388,11 +8418,6 @@ async def test_get_link_async( assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE -@pytest.mark.asyncio -async def test_get_link_async_from_dict(): - await test_get_link_async(request_type=dict) - - def test_get_link_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -8535,8 +8560,8 @@ async def test_get_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListExclusionsRequest, - dict, + logging_config.ListExclusionsRequest({}), + {}, ], ) def test_list_exclusions(request_type, transport: str = "grpc"): @@ -8547,7 +8572,7 @@ def test_list_exclusions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_exclusions), "__call__") as call: @@ -8592,10 +8617,11 @@ def test_list_exclusions_non_empty_request_with_auto_populated_field(): client.list_exclusions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListExclusionsRequest( + request_msg = logging_config.ListExclusionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_exclusions_use_cached_wrapped_rpc(): @@ -8676,9 +8702,14 @@ async def test_list_exclusions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_exclusions_async( - transport: str = "grpc_asyncio", request_type=logging_config.ListExclusionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.ListExclusionsRequest({}), + {}, + ], +) +async def test_list_exclusions_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8686,7 +8717,7 @@ async def test_list_exclusions_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_exclusions), "__call__") as call: @@ -8709,11 +8740,6 @@ async def test_list_exclusions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_exclusions_async_from_dict(): - await test_list_exclusions_async(request_type=dict) - - def test_list_exclusions_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9050,8 +9076,8 @@ async def test_list_exclusions_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetExclusionRequest, - dict, + logging_config.GetExclusionRequest({}), + {}, ], ) def test_get_exclusion(request_type, transport: str = "grpc"): @@ -9062,7 +9088,7 @@ def test_get_exclusion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_exclusion), "__call__") as call: @@ -9112,9 +9138,10 @@ def test_get_exclusion_non_empty_request_with_auto_populated_field(): client.get_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetExclusionRequest( + request_msg = logging_config.GetExclusionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_exclusion_use_cached_wrapped_rpc(): @@ -9195,9 +9222,14 @@ async def test_get_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_exclusion_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetExclusionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetExclusionRequest({}), + {}, + ], +) +async def test_get_exclusion_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9205,7 +9237,7 @@ async def test_get_exclusion_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_exclusion), "__call__") as call: @@ -9234,11 +9266,6 @@ async def test_get_exclusion_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_exclusion_async_from_dict(): - await test_get_exclusion_async(request_type=dict) - - def test_get_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9385,8 +9412,8 @@ async def test_get_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateExclusionRequest, - dict, + logging_config.CreateExclusionRequest({}), + {}, ], ) def test_create_exclusion(request_type, transport: str = "grpc"): @@ -9397,7 +9424,7 @@ def test_create_exclusion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_exclusion), "__call__") as call: @@ -9447,9 +9474,10 @@ def test_create_exclusion_non_empty_request_with_auto_populated_field(): client.create_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateExclusionRequest( + request_msg = logging_config.CreateExclusionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_exclusion_use_cached_wrapped_rpc(): @@ -9532,9 +9560,14 @@ async def test_create_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_exclusion_async( - transport: str = "grpc_asyncio", request_type=logging_config.CreateExclusionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CreateExclusionRequest({}), + {}, + ], +) +async def test_create_exclusion_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9542,7 +9575,7 @@ async def test_create_exclusion_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_exclusion), "__call__") as call: @@ -9571,11 +9604,6 @@ async def test_create_exclusion_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_create_exclusion_async_from_dict(): - await test_create_exclusion_async(request_type=dict) - - def test_create_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -9732,8 +9760,8 @@ async def test_create_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateExclusionRequest, - dict, + logging_config.UpdateExclusionRequest({}), + {}, ], ) def test_update_exclusion(request_type, transport: str = "grpc"): @@ -9744,7 +9772,7 @@ def test_update_exclusion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_exclusion), "__call__") as call: @@ -9794,9 +9822,10 @@ def test_update_exclusion_non_empty_request_with_auto_populated_field(): client.update_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateExclusionRequest( + request_msg = logging_config.UpdateExclusionRequest( name="name_value", ) + assert args[0] == request_msg def test_update_exclusion_use_cached_wrapped_rpc(): @@ -9879,9 +9908,14 @@ async def test_update_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_exclusion_async( - transport: str = "grpc_asyncio", request_type=logging_config.UpdateExclusionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateExclusionRequest({}), + {}, + ], +) +async def test_update_exclusion_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9889,7 +9923,7 @@ async def test_update_exclusion_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_exclusion), "__call__") as call: @@ -9918,11 +9952,6 @@ async def test_update_exclusion_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_update_exclusion_async_from_dict(): - await test_update_exclusion_async(request_type=dict) - - def test_update_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10089,8 +10118,8 @@ async def test_update_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteExclusionRequest, - dict, + logging_config.DeleteExclusionRequest({}), + {}, ], ) def test_delete_exclusion(request_type, transport: str = "grpc"): @@ -10101,7 +10130,7 @@ def test_delete_exclusion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_exclusion), "__call__") as call: @@ -10142,9 +10171,10 @@ def test_delete_exclusion_non_empty_request_with_auto_populated_field(): client.delete_exclusion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteExclusionRequest( + request_msg = logging_config.DeleteExclusionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_exclusion_use_cached_wrapped_rpc(): @@ -10227,9 +10257,14 @@ async def test_delete_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_exclusion_async( - transport: str = "grpc_asyncio", request_type=logging_config.DeleteExclusionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.DeleteExclusionRequest({}), + {}, + ], +) +async def test_delete_exclusion_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10237,7 +10272,7 @@ async def test_delete_exclusion_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_exclusion), "__call__") as call: @@ -10255,11 +10290,6 @@ async def test_delete_exclusion_async( assert response is None -@pytest.mark.asyncio -async def test_delete_exclusion_async_from_dict(): - await test_delete_exclusion_async(request_type=dict) - - def test_delete_exclusion_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10402,8 +10432,8 @@ async def test_delete_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetCmekSettingsRequest, - dict, + logging_config.GetCmekSettingsRequest({}), + {}, ], ) def test_get_cmek_settings(request_type, transport: str = "grpc"): @@ -10414,7 +10444,7 @@ def test_get_cmek_settings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10468,9 +10498,10 @@ def test_get_cmek_settings_non_empty_request_with_auto_populated_field(): client.get_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetCmekSettingsRequest( + request_msg = logging_config.GetCmekSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cmek_settings_use_cached_wrapped_rpc(): @@ -10553,9 +10584,14 @@ async def test_get_cmek_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cmek_settings_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetCmekSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetCmekSettingsRequest({}), + {}, + ], +) +async def test_get_cmek_settings_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10563,7 +10599,7 @@ async def test_get_cmek_settings_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10594,11 +10630,6 @@ async def test_get_cmek_settings_async( assert response.service_account_id == "service_account_id_value" -@pytest.mark.asyncio -async def test_get_cmek_settings_async_from_dict(): - await test_get_cmek_settings_async(request_type=dict) - - def test_get_cmek_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10667,8 +10698,8 @@ async def test_get_cmek_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateCmekSettingsRequest, - dict, + logging_config.UpdateCmekSettingsRequest({}), + {}, ], ) def test_update_cmek_settings(request_type, transport: str = "grpc"): @@ -10679,7 +10710,7 @@ def test_update_cmek_settings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10733,9 +10764,10 @@ def test_update_cmek_settings_non_empty_request_with_auto_populated_field(): client.update_cmek_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateCmekSettingsRequest( + request_msg = logging_config.UpdateCmekSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_update_cmek_settings_use_cached_wrapped_rpc(): @@ -10820,9 +10852,15 @@ async def test_update_cmek_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateCmekSettingsRequest({}), + {}, + ], +) async def test_update_cmek_settings_async( - transport: str = "grpc_asyncio", - request_type=logging_config.UpdateCmekSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), @@ -10831,7 +10869,7 @@ async def test_update_cmek_settings_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10862,11 +10900,6 @@ async def test_update_cmek_settings_async( assert response.service_account_id == "service_account_id_value" -@pytest.mark.asyncio -async def test_update_cmek_settings_async_from_dict(): - await test_update_cmek_settings_async(request_type=dict) - - def test_update_cmek_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -10935,8 +10968,8 @@ async def test_update_cmek_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetSettingsRequest, - dict, + logging_config.GetSettingsRequest({}), + {}, ], ) def test_get_settings(request_type, transport: str = "grpc"): @@ -10947,7 +10980,7 @@ def test_get_settings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_settings), "__call__") as call: @@ -10999,9 +11032,10 @@ def test_get_settings_non_empty_request_with_auto_populated_field(): client.get_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSettingsRequest( + request_msg = logging_config.GetSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_settings_use_cached_wrapped_rpc(): @@ -11082,9 +11116,14 @@ async def test_get_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_settings_async( - transport: str = "grpc_asyncio", request_type=logging_config.GetSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.GetSettingsRequest({}), + {}, + ], +) +async def test_get_settings_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11092,7 +11131,7 @@ async def test_get_settings_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_settings), "__call__") as call: @@ -11123,11 +11162,6 @@ async def test_get_settings_async( assert response.disable_default_sink is True -@pytest.mark.asyncio -async def test_get_settings_async_from_dict(): - await test_get_settings_async(request_type=dict) - - def test_get_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -11274,8 +11308,8 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateSettingsRequest, - dict, + logging_config.UpdateSettingsRequest({}), + {}, ], ) def test_update_settings(request_type, transport: str = "grpc"): @@ -11286,7 +11320,7 @@ def test_update_settings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_settings), "__call__") as call: @@ -11338,9 +11372,10 @@ def test_update_settings_non_empty_request_with_auto_populated_field(): client.update_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSettingsRequest( + request_msg = logging_config.UpdateSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_update_settings_use_cached_wrapped_rpc(): @@ -11421,9 +11456,14 @@ async def test_update_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_settings_async( - transport: str = "grpc_asyncio", request_type=logging_config.UpdateSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.UpdateSettingsRequest({}), + {}, + ], +) +async def test_update_settings_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11431,7 +11471,7 @@ async def test_update_settings_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_settings), "__call__") as call: @@ -11462,11 +11502,6 @@ async def test_update_settings_async( assert response.disable_default_sink is True -@pytest.mark.asyncio -async def test_update_settings_async_from_dict(): - await test_update_settings_async(request_type=dict) - - def test_update_settings_field_headers(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -11623,8 +11658,8 @@ async def test_update_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CopyLogEntriesRequest, - dict, + logging_config.CopyLogEntriesRequest({}), + {}, ], ) def test_copy_log_entries(request_type, transport: str = "grpc"): @@ -11635,7 +11670,7 @@ def test_copy_log_entries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.copy_log_entries), "__call__") as call: @@ -11678,11 +11713,12 @@ def test_copy_log_entries_non_empty_request_with_auto_populated_field(): client.copy_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CopyLogEntriesRequest( + request_msg = logging_config.CopyLogEntriesRequest( name="name_value", filter="filter_value", destination="destination_value", ) + assert args[0] == request_msg def test_copy_log_entries_use_cached_wrapped_rpc(): @@ -11775,9 +11811,14 @@ async def test_copy_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_copy_log_entries_async( - transport: str = "grpc_asyncio", request_type=logging_config.CopyLogEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_config.CopyLogEntriesRequest({}), + {}, + ], +) +async def test_copy_log_entries_async(request_type, transport: str = "grpc_asyncio"): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11785,7 +11826,7 @@ async def test_copy_log_entries_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.copy_log_entries), "__call__") as call: @@ -11805,11 +11846,6 @@ async def test_copy_log_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_copy_log_entries_async_from_dict(): - await test_copy_log_entries_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ConfigServiceV2GrpcTransport( @@ -11932,7 +11968,6 @@ def test_list_buckets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() - assert args[0] == request_msg @@ -11953,7 +11988,6 @@ def test_get_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() - assert args[0] == request_msg @@ -11976,7 +12010,6 @@ def test_create_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -11999,7 +12032,6 @@ def test_update_bucket_async_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -12020,7 +12052,6 @@ def test_create_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -12041,7 +12072,6 @@ def test_update_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -12062,7 +12092,6 @@ def test_delete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() - assert args[0] == request_msg @@ -12083,7 +12112,6 @@ def test_undelete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() - assert args[0] == request_msg @@ -12104,7 +12132,6 @@ def test_list_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() - assert args[0] == request_msg @@ -12125,7 +12152,6 @@ def test_get_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() - assert args[0] == request_msg @@ -12146,7 +12172,6 @@ def test_create_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() - assert args[0] == request_msg @@ -12167,7 +12192,6 @@ def test_update_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() - assert args[0] == request_msg @@ -12188,7 +12212,6 @@ def test_delete_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() - assert args[0] == request_msg @@ -12209,7 +12232,6 @@ def test_list_sinks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() - assert args[0] == request_msg @@ -12230,7 +12252,6 @@ def test_get_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() - assert args[0] == request_msg @@ -12251,7 +12272,6 @@ def test_create_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() - assert args[0] == request_msg @@ -12272,7 +12292,6 @@ def test_update_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() - assert args[0] == request_msg @@ -12293,7 +12312,6 @@ def test_delete_sink_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() - assert args[0] == request_msg @@ -12314,7 +12332,6 @@ def test_create_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() - assert args[0] == request_msg @@ -12335,7 +12352,6 @@ def test_delete_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() - assert args[0] == request_msg @@ -12356,7 +12372,6 @@ def test_list_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() - assert args[0] == request_msg @@ -12377,7 +12392,6 @@ def test_get_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() - assert args[0] == request_msg @@ -12398,7 +12412,6 @@ def test_list_exclusions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() - assert args[0] == request_msg @@ -12419,7 +12432,6 @@ def test_get_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() - assert args[0] == request_msg @@ -12440,7 +12452,6 @@ def test_create_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() - assert args[0] == request_msg @@ -12461,7 +12472,6 @@ def test_update_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() - assert args[0] == request_msg @@ -12482,7 +12492,6 @@ def test_delete_exclusion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() - assert args[0] == request_msg @@ -12505,7 +12514,6 @@ def test_get_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() - assert args[0] == request_msg @@ -12528,7 +12536,6 @@ def test_update_cmek_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() - assert args[0] == request_msg @@ -12549,7 +12556,6 @@ def test_get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() - assert args[0] == request_msg @@ -12570,7 +12576,6 @@ def test_update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() - assert args[0] == request_msg @@ -12591,7 +12596,6 @@ def test_copy_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() - assert args[0] == request_msg @@ -12632,7 +12636,6 @@ async def test_list_buckets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() - assert args[0] == request_msg @@ -12665,7 +12668,6 @@ async def test_get_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() - assert args[0] == request_msg @@ -12692,7 +12694,6 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -12719,7 +12720,6 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -12752,7 +12752,6 @@ async def test_create_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() - assert args[0] == request_msg @@ -12785,7 +12784,6 @@ async def test_update_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() - assert args[0] == request_msg @@ -12808,7 +12806,6 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() - assert args[0] == request_msg @@ -12831,7 +12828,6 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() - assert args[0] == request_msg @@ -12858,7 +12854,6 @@ async def test_list_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() - assert args[0] == request_msg @@ -12887,7 +12882,6 @@ async def test_get_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() - assert args[0] == request_msg @@ -12916,7 +12910,6 @@ async def test_create_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() - assert args[0] == request_msg @@ -12945,7 +12938,6 @@ async def test_update_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() - assert args[0] == request_msg @@ -12968,7 +12960,6 @@ async def test_delete_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() - assert args[0] == request_msg @@ -12995,7 +12986,6 @@ async def test_list_sinks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() - assert args[0] == request_msg @@ -13029,7 +13019,6 @@ async def test_get_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() - assert args[0] == request_msg @@ -13063,7 +13052,6 @@ async def test_create_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() - assert args[0] == request_msg @@ -13097,7 +13085,6 @@ async def test_update_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() - assert args[0] == request_msg @@ -13120,7 +13107,6 @@ async def test_delete_sink_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() - assert args[0] == request_msg @@ -13145,7 +13131,6 @@ async def test_create_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() - assert args[0] == request_msg @@ -13170,7 +13155,6 @@ async def test_delete_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() - assert args[0] == request_msg @@ -13197,7 +13181,6 @@ async def test_list_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() - assert args[0] == request_msg @@ -13226,7 +13209,6 @@ async def test_get_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() - assert args[0] == request_msg @@ -13253,7 +13235,6 @@ async def test_list_exclusions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() - assert args[0] == request_msg @@ -13283,7 +13264,6 @@ async def test_get_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() - assert args[0] == request_msg @@ -13313,7 +13293,6 @@ async def test_create_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() - assert args[0] == request_msg @@ -13343,7 +13322,6 @@ async def test_update_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() - assert args[0] == request_msg @@ -13366,7 +13344,6 @@ async def test_delete_exclusion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() - assert args[0] == request_msg @@ -13398,7 +13375,6 @@ async def test_get_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() - assert args[0] == request_msg @@ -13430,7 +13406,6 @@ async def test_update_cmek_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() - assert args[0] == request_msg @@ -13461,7 +13436,6 @@ async def test_get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() - assert args[0] == request_msg @@ -13492,7 +13466,6 @@ async def test_update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() - assert args[0] == request_msg @@ -13517,7 +13490,6 @@ async def test_copy_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 2515b0b5aaf5..a7996c112686 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -71,6 +71,9 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" +) async def mock_async_gen(data, chunk_size=1): @@ -1335,8 +1338,8 @@ def test_logging_service_v2_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - logging.DeleteLogRequest, - dict, + logging.DeleteLogRequest({}), + {}, ], ) def test_delete_log(request_type, transport: str = "grpc"): @@ -1347,7 +1350,7 @@ def test_delete_log(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_log), "__call__") as call: @@ -1388,9 +1391,10 @@ def test_delete_log_non_empty_request_with_auto_populated_field(): client.delete_log(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.DeleteLogRequest( + request_msg = logging.DeleteLogRequest( log_name="log_name_value", ) + assert args[0] == request_msg def test_delete_log_use_cached_wrapped_rpc(): @@ -1469,9 +1473,14 @@ async def test_delete_log_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_log_async( - transport: str = "grpc_asyncio", request_type=logging.DeleteLogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging.DeleteLogRequest({}), + {}, + ], +) +async def test_delete_log_async(request_type, transport: str = "grpc_asyncio"): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1479,7 +1488,7 @@ async def test_delete_log_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_log), "__call__") as call: @@ -1497,11 +1506,6 @@ async def test_delete_log_async( assert response is None -@pytest.mark.asyncio -async def test_delete_log_async_from_dict(): - await test_delete_log_async(request_type=dict) - - def test_delete_log_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1644,8 +1648,8 @@ async def test_delete_log_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging.WriteLogEntriesRequest, - dict, + logging.WriteLogEntriesRequest({}), + {}, ], ) def test_write_log_entries(request_type, transport: str = "grpc"): @@ -1656,7 +1660,7 @@ def test_write_log_entries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1701,9 +1705,10 @@ def test_write_log_entries_non_empty_request_with_auto_populated_field(): client.write_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.WriteLogEntriesRequest( + request_msg = logging.WriteLogEntriesRequest( log_name="log_name_value", ) + assert args[0] == request_msg def test_write_log_entries_use_cached_wrapped_rpc(): @@ -1786,9 +1791,14 @@ async def test_write_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_log_entries_async( - transport: str = "grpc_asyncio", request_type=logging.WriteLogEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging.WriteLogEntriesRequest({}), + {}, + ], +) +async def test_write_log_entries_async(request_type, transport: str = "grpc_asyncio"): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1796,7 +1806,7 @@ async def test_write_log_entries_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1818,11 +1828,6 @@ async def test_write_log_entries_async( assert isinstance(response, logging.WriteLogEntriesResponse) -@pytest.mark.asyncio -async def test_write_log_entries_async_from_dict(): - await test_write_log_entries_async(request_type=dict) - - def test_write_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1942,8 +1947,8 @@ async def test_write_log_entries_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging.ListLogEntriesRequest, - dict, + logging.ListLogEntriesRequest({}), + {}, ], ) def test_list_log_entries(request_type, transport: str = "grpc"): @@ -1954,7 +1959,7 @@ def test_list_log_entries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_log_entries), "__call__") as call: @@ -2000,11 +2005,12 @@ def test_list_log_entries_non_empty_request_with_auto_populated_field(): client.list_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogEntriesRequest( + request_msg = logging.ListLogEntriesRequest( filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_log_entries_use_cached_wrapped_rpc(): @@ -2087,9 +2093,14 @@ async def test_list_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_log_entries_async( - transport: str = "grpc_asyncio", request_type=logging.ListLogEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging.ListLogEntriesRequest({}), + {}, + ], +) +async def test_list_log_entries_async(request_type, transport: str = "grpc_asyncio"): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2097,7 +2108,7 @@ async def test_list_log_entries_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_log_entries), "__call__") as call: @@ -2120,11 +2131,6 @@ async def test_list_log_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_log_entries_async_from_dict(): - await test_list_log_entries_async(request_type=dict) - - def test_list_log_entries_flattened(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2417,8 +2423,8 @@ async def test_list_log_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging.ListMonitoredResourceDescriptorsRequest, - dict, + logging.ListMonitoredResourceDescriptorsRequest({}), + {}, ], ) def test_list_monitored_resource_descriptors(request_type, transport: str = "grpc"): @@ -2429,7 +2435,7 @@ def test_list_monitored_resource_descriptors(request_type, transport: str = "grp # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2477,9 +2483,10 @@ def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populat client.list_monitored_resource_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListMonitoredResourceDescriptorsRequest( + request_msg = logging.ListMonitoredResourceDescriptorsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_monitored_resource_descriptors_use_cached_wrapped_rpc(): @@ -2565,9 +2572,15 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + logging.ListMonitoredResourceDescriptorsRequest({}), + {}, + ], +) async def test_list_monitored_resource_descriptors_async( - transport: str = "grpc_asyncio", - request_type=logging.ListMonitoredResourceDescriptorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), @@ -2576,7 +2589,7 @@ async def test_list_monitored_resource_descriptors_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2601,11 +2614,6 @@ async def test_list_monitored_resource_descriptors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_monitored_resource_descriptors_async_from_dict(): - await test_list_monitored_resource_descriptors_async(request_type=dict) - - def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc"): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2814,8 +2822,8 @@ async def test_list_monitored_resource_descriptors_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging.ListLogsRequest, - dict, + logging.ListLogsRequest({}), + {}, ], ) def test_list_logs(request_type, transport: str = "grpc"): @@ -2826,7 +2834,7 @@ def test_list_logs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_logs), "__call__") as call: @@ -2873,10 +2881,11 @@ def test_list_logs_non_empty_request_with_auto_populated_field(): client.list_logs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogsRequest( + request_msg = logging.ListLogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_logs_use_cached_wrapped_rpc(): @@ -2955,9 +2964,14 @@ async def test_list_logs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_logs_async( - transport: str = "grpc_asyncio", request_type=logging.ListLogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging.ListLogsRequest({}), + {}, + ], +) +async def test_list_logs_async(request_type, transport: str = "grpc_asyncio"): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2965,7 +2979,7 @@ async def test_list_logs_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_logs), "__call__") as call: @@ -2990,11 +3004,6 @@ async def test_list_logs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_logs_async_from_dict(): - await test_list_logs_async(request_type=dict) - - def test_list_logs_field_headers(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3331,8 +3340,8 @@ async def test_list_logs_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging.TailLogEntriesRequest, - dict, + logging.TailLogEntriesRequest({}), + {}, ], ) def test_tail_log_entries(request_type, transport: str = "grpc"): @@ -3343,7 +3352,7 @@ def test_tail_log_entries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -3442,9 +3451,14 @@ async def test_tail_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_tail_log_entries_async( - transport: str = "grpc_asyncio", request_type=logging.TailLogEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging.TailLogEntriesRequest({}), + {}, + ], +) +async def test_tail_log_entries_async(request_type, transport: str = "grpc_asyncio"): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3452,7 +3466,7 @@ async def test_tail_log_entries_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type requests = [request] # Mock the actual call within the gRPC stub, and fake the request. @@ -3474,11 +3488,6 @@ async def test_tail_log_entries_async( assert isinstance(message, logging.TailLogEntriesResponse) -@pytest.mark.asyncio -async def test_tail_log_entries_async_from_dict(): - await test_tail_log_entries_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LoggingServiceV2GrpcTransport( @@ -3601,7 +3610,6 @@ def test_delete_log_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() - assert args[0] == request_msg @@ -3624,7 +3632,6 @@ def test_write_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() - assert args[0] == request_msg @@ -3645,7 +3652,6 @@ def test_list_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() - assert args[0] == request_msg @@ -3668,7 +3674,6 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -3689,7 +3694,6 @@ def test_list_logs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() - assert args[0] == request_msg @@ -3726,7 +3730,6 @@ async def test_delete_log_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() - assert args[0] == request_msg @@ -3753,7 +3756,6 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() - assert args[0] == request_msg @@ -3780,7 +3782,6 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() - assert args[0] == request_msg @@ -3809,7 +3810,6 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -3837,7 +3837,6 @@ async def test_list_logs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 541ed0e7657c..fe21c624a419 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -70,6 +70,9 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" +) async def mock_async_gen(data, chunk_size=1): @@ -1334,8 +1337,8 @@ def test_metrics_service_v2_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - logging_metrics.ListLogMetricsRequest, - dict, + logging_metrics.ListLogMetricsRequest({}), + {}, ], ) def test_list_log_metrics(request_type, transport: str = "grpc"): @@ -1346,7 +1349,7 @@ def test_list_log_metrics(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_log_metrics), "__call__") as call: @@ -1391,10 +1394,11 @@ def test_list_log_metrics_non_empty_request_with_auto_populated_field(): client.list_log_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.ListLogMetricsRequest( + request_msg = logging_metrics.ListLogMetricsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_log_metrics_use_cached_wrapped_rpc(): @@ -1477,9 +1481,14 @@ async def test_list_log_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_log_metrics_async( - transport: str = "grpc_asyncio", request_type=logging_metrics.ListLogMetricsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_metrics.ListLogMetricsRequest({}), + {}, + ], +) +async def test_list_log_metrics_async(request_type, transport: str = "grpc_asyncio"): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1487,7 +1496,7 @@ async def test_list_log_metrics_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_log_metrics), "__call__") as call: @@ -1510,11 +1519,6 @@ async def test_list_log_metrics_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_log_metrics_async_from_dict(): - await test_list_log_metrics_async(request_type=dict) - - def test_list_log_metrics_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1851,8 +1855,8 @@ async def test_list_log_metrics_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.GetLogMetricRequest, - dict, + logging_metrics.GetLogMetricRequest({}), + {}, ], ) def test_get_log_metric(request_type, transport: str = "grpc"): @@ -1863,7 +1867,7 @@ def test_get_log_metric(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_log_metric), "__call__") as call: @@ -1919,9 +1923,10 @@ def test_get_log_metric_non_empty_request_with_auto_populated_field(): client.get_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.GetLogMetricRequest( + request_msg = logging_metrics.GetLogMetricRequest( metric_name="metric_name_value", ) + assert args[0] == request_msg def test_get_log_metric_use_cached_wrapped_rpc(): @@ -2002,9 +2007,14 @@ async def test_get_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_log_metric_async( - transport: str = "grpc_asyncio", request_type=logging_metrics.GetLogMetricRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_metrics.GetLogMetricRequest({}), + {}, + ], +) +async def test_get_log_metric_async(request_type, transport: str = "grpc_asyncio"): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2012,7 +2022,7 @@ async def test_get_log_metric_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_log_metric), "__call__") as call: @@ -2047,11 +2057,6 @@ async def test_get_log_metric_async( assert response.version == logging_metrics.LogMetric.ApiVersion.V1 -@pytest.mark.asyncio -async def test_get_log_metric_async_from_dict(): - await test_get_log_metric_async(request_type=dict) - - def test_get_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2198,8 +2203,8 @@ async def test_get_log_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.CreateLogMetricRequest, - dict, + logging_metrics.CreateLogMetricRequest({}), + {}, ], ) def test_create_log_metric(request_type, transport: str = "grpc"): @@ -2210,7 +2215,7 @@ def test_create_log_metric(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2270,9 +2275,10 @@ def test_create_log_metric_non_empty_request_with_auto_populated_field(): client.create_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.CreateLogMetricRequest( + request_msg = logging_metrics.CreateLogMetricRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_log_metric_use_cached_wrapped_rpc(): @@ -2355,9 +2361,14 @@ async def test_create_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_log_metric_async( - transport: str = "grpc_asyncio", request_type=logging_metrics.CreateLogMetricRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_metrics.CreateLogMetricRequest({}), + {}, + ], +) +async def test_create_log_metric_async(request_type, transport: str = "grpc_asyncio"): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2365,7 +2376,7 @@ async def test_create_log_metric_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2402,11 +2413,6 @@ async def test_create_log_metric_async( assert response.version == logging_metrics.LogMetric.ApiVersion.V1 -@pytest.mark.asyncio -async def test_create_log_metric_async_from_dict(): - await test_create_log_metric_async(request_type=dict) - - def test_create_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2577,8 @@ async def test_create_log_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.UpdateLogMetricRequest, - dict, + logging_metrics.UpdateLogMetricRequest({}), + {}, ], ) def test_update_log_metric(request_type, transport: str = "grpc"): @@ -2583,7 +2589,7 @@ def test_update_log_metric(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2643,9 +2649,10 @@ def test_update_log_metric_non_empty_request_with_auto_populated_field(): client.update_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.UpdateLogMetricRequest( + request_msg = logging_metrics.UpdateLogMetricRequest( metric_name="metric_name_value", ) + assert args[0] == request_msg def test_update_log_metric_use_cached_wrapped_rpc(): @@ -2728,9 +2735,14 @@ async def test_update_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_log_metric_async( - transport: str = "grpc_asyncio", request_type=logging_metrics.UpdateLogMetricRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_metrics.UpdateLogMetricRequest({}), + {}, + ], +) +async def test_update_log_metric_async(request_type, transport: str = "grpc_asyncio"): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2738,7 +2750,7 @@ async def test_update_log_metric_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2775,11 +2787,6 @@ async def test_update_log_metric_async( assert response.version == logging_metrics.LogMetric.ApiVersion.V1 -@pytest.mark.asyncio -async def test_update_log_metric_async_from_dict(): - await test_update_log_metric_async(request_type=dict) - - def test_update_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2944,8 +2951,8 @@ async def test_update_log_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.DeleteLogMetricRequest, - dict, + logging_metrics.DeleteLogMetricRequest({}), + {}, ], ) def test_delete_log_metric(request_type, transport: str = "grpc"): @@ -2956,7 +2963,7 @@ def test_delete_log_metric(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3001,9 +3008,10 @@ def test_delete_log_metric_non_empty_request_with_auto_populated_field(): client.delete_log_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.DeleteLogMetricRequest( + request_msg = logging_metrics.DeleteLogMetricRequest( metric_name="metric_name_value", ) + assert args[0] == request_msg def test_delete_log_metric_use_cached_wrapped_rpc(): @@ -3086,9 +3094,14 @@ async def test_delete_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_log_metric_async( - transport: str = "grpc_asyncio", request_type=logging_metrics.DeleteLogMetricRequest -): +@pytest.mark.parametrize( + "request_type", + [ + logging_metrics.DeleteLogMetricRequest({}), + {}, + ], +) +async def test_delete_log_metric_async(request_type, transport: str = "grpc_asyncio"): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3096,7 +3109,7 @@ async def test_delete_log_metric_async( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3116,11 +3129,6 @@ async def test_delete_log_metric_async( assert response is None -@pytest.mark.asyncio -async def test_delete_log_metric_async_from_dict(): - await test_delete_log_metric_async(request_type=dict) - - def test_delete_log_metric_field_headers(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3390,7 +3398,6 @@ def test_list_log_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() - assert args[0] == request_msg @@ -3411,7 +3418,6 @@ def test_get_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() - assert args[0] == request_msg @@ -3434,7 +3440,6 @@ def test_create_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() - assert args[0] == request_msg @@ -3457,7 +3462,6 @@ def test_update_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() - assert args[0] == request_msg @@ -3480,7 +3484,6 @@ def test_delete_log_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() - assert args[0] == request_msg @@ -3521,7 +3524,6 @@ async def test_list_log_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() - assert args[0] == request_msg @@ -3554,7 +3556,6 @@ async def test_get_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() - assert args[0] == request_msg @@ -3589,7 +3590,6 @@ async def test_create_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() - assert args[0] == request_msg @@ -3624,7 +3624,6 @@ async def test_update_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() - assert args[0] == request_msg @@ -3649,7 +3648,6 @@ async def test_delete_log_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py index 64e52abeefe4..abd69196c1b6 100644 --- a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py +++ b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py @@ -121,7 +121,7 @@ def _lower_bound(requirement: Requirement) -> str: Returns: str: The lower bound for the requirement. """ - spec_set = list(requirement.specifier) + spec_set = [s for s in requirement.specifier if s.operator != "!="] # sort by operator: <, then >= spec_set.sort(key=lambda x: x.operator) From 61c0f39322160a6b4a00a045dd602b0c8b2bf318 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 05:46:55 -0400 Subject: [PATCH 24/28] revert: restore lower_bound_checker.py to pristine state --- .../test_utils/lower_bound_checker/lower_bound_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py index abd69196c1b6..64e52abeefe4 100644 --- a/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py +++ b/packages/google-cloud-testutils/test_utils/lower_bound_checker/lower_bound_checker.py @@ -121,7 +121,7 @@ def _lower_bound(requirement: Requirement) -> str: Returns: str: The lower bound for the requirement. """ - spec_set = [s for s in requirement.specifier if s.operator != "!="] + spec_set = list(requirement.specifier) # sort by operator: <, then >= spec_set.sort(key=lambda x: x.operator) From 5389fc1aefc1d464b78de38e3d02464c9afbcf5b Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 06:18:13 -0400 Subject: [PATCH 25/28] refactor(logging): integrate constraints-3.10.txt post-processing rule natively to prevent duplicates --- .../logging-integration.yaml | 23 +++++++++++++++++++ .../google-cloud-logging/CONTRIBUTING.rst | 14 +++++++---- .../google/cloud/logging_v2/client.py | 3 +-- packages/google-cloud-logging/noxfile.py | 7 +----- packages/google-cloud-logging/pytest.ini | 12 ++++++---- .../testing/constraints-3.10.txt | 12 ++++++---- .../tests/unit/test_logger.py | 11 +++++++++ 7 files changed, 62 insertions(+), 20 deletions(-) diff --git a/.librarian/generator-input/client-post-processing/logging-integration.yaml b/.librarian/generator-input/client-post-processing/logging-integration.yaml index 8ebed3fcce7e..c64fb55fff2a 100644 --- a/.librarian/generator-input/client-post-processing/logging-integration.yaml +++ b/.librarian/generator-input/client-post-processing/logging-integration.yaml @@ -48,6 +48,29 @@ replacements: "opentelemetry-api >= 1.16.0", "grpcio >= 1.59.0, < 2.0.0", count: 1 + - paths: [ + "packages/google-cloud-logging/testing/constraints-3.10.txt" + ] + before: | + # then this file should have google-cloud-foo==1.14.0 + google-api-core==2.17.1 + google-auth==2.14.1 + grpcio==1.59.0 + proto-plus==1.22.3 + protobuf==4.25.8 + after: | + # then this file should have google-cloud-foo==1.14.0 + google-api-core==2.17.1 + google-auth==2.14.1 + google-cloud-appengine-logging==0.1.3 + google-cloud-audit-log==0.3.1 + google-cloud-core==2.0.0 + grpc-google-iam-v1==0.12.4 + opentelemetry-api==1.16.0 + grpcio==1.59.0 + proto-plus==1.22.3 + protobuf==4.25.8 + count: 1 - paths: [ "packages/google-cloud-logging/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py", "packages/google-cloud-logging/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py", diff --git a/packages/google-cloud-logging/CONTRIBUTING.rst b/packages/google-cloud-logging/CONTRIBUTING.rst index 621f0ad35577..1e7146486737 100644 --- a/packages/google-cloud-logging/CONTRIBUTING.rst +++ b/packages/google-cloud-logging/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows. + 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -195,11 +195,11 @@ configure them just like the System Tests. # Run all tests in a folder $ cd samples/snippets - $ nox -s py-3.10 + $ nox -s py-3.8 # Run a single sample test $ cd samples/snippets - $ nox -s py-3.10 -- -k + $ nox -s py-3.8 -- -k ******************************************** Note About ``README`` as it pertains to PyPI @@ -221,12 +221,18 @@ Supported Python Versions We support: +- `Python 3.7`_ +- `Python 3.8`_ +- `Python 3.9`_ - `Python 3.10`_ - `Python 3.11`_ - `Python 3.12`_ - `Python 3.13`_ - `Python 3.14`_ +.. _Python 3.7: https://docs.python.org/3.7/ +.. _Python 3.8: https://docs.python.org/3.8/ +.. _Python 3.9: https://docs.python.org/3.9/ .. _Python 3.10: https://docs.python.org/3.10/ .. _Python 3.11: https://docs.python.org/3.11/ .. _Python 3.12: https://docs.python.org/3.12/ @@ -239,7 +245,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/google-cloud-python/blob/main/noxfile.py -We also explicitly decided to support Python 3 beginning with version 3.10. +We also explicitly decided to support Python 3 beginning with version 3.7. Reasons for this include: - Encouraging use of newest versions of Python 3 diff --git a/packages/google-cloud-logging/google/cloud/logging_v2/client.py b/packages/google-cloud-logging/google/cloud/logging_v2/client.py index 2770a17030e1..7f0e62d58700 100644 --- a/packages/google-cloud-logging/google/cloud/logging_v2/client.py +++ b/packages/google-cloud-logging/google/cloud/logging_v2/client.py @@ -383,8 +383,7 @@ def get_default_handler(self, **kw): elif monitored_resource.type == _GKE_RESOURCE_TYPE: return StructuredLogHandler(**kw, project_id=self.project) elif monitored_resource.type == _GCF_RESOURCE_TYPE: - # Bypassing redirects via __stdout__ ensures structured logging - # works robustly on GCF even if stdout is redirected by wrappers. + # __stdout__ stream required to support structured logging on Python 3.7 kw["stream"] = kw.get("stream", sys.__stdout__) return StructuredLogHandler(**kw, project_id=self.project) elif monitored_resource.type == _RUN_RESOURCE_TYPE: diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index fe52995013b6..6b5ca5479c27 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -47,12 +47,7 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() -if (CURRENT_DIRECTORY / "testing").exists(): - LOWER_BOUND_CONSTRAINTS_FILE = ( - CURRENT_DIRECTORY / "testing" / f"constraints-{ALL_PYTHON[0]}.txt" - ) -else: - LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ diff --git a/packages/google-cloud-logging/pytest.ini b/packages/google-cloud-logging/pytest.ini index 4c019fe6709b..414f82a6cc7e 100644 --- a/packages/google-cloud-logging/pytest.ini +++ b/packages/google-cloud-logging/pytest.ini @@ -13,6 +13,14 @@ filterwarnings = ignore:get_mtls_endpoint_and_cert_source is deprecated.:DeprecationWarning # DeprecationWarnings triggered by Flask 1.0 testing by Flask dependencies in test code ignore:Importing 'itsdangerous.json' is deprecated and will be removed in ItsDangerous 2.1:DeprecationWarning + # 3.7 deprecation warnings, remove after support for Python 3.7 is dropped + ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning + ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working:DeprecationWarning + ignore:You are using a non-supported Python version \(3\.7:FutureWarning + # 3.8 deprecation warnings, remove after support for Python 3.8 is dropped + ignore:You are using a non-supported Python version \(3\.8:FutureWarning + # 3.9 deprecation warnings, remove after support for Python 3.9 is dropped + ignore:You are using a Python version \(3\.9:FutureWarning # 3.10 deprecation warnings, remove after support for Python 3.10 is dropped ignore:You are using a Python version \(3\.10:FutureWarning ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working:DeprecationWarning @@ -20,10 +28,6 @@ filterwarnings = ignore:Attribute s is deprecated and will be removed in Python 3.14; use value instead:DeprecationWarning ignore:ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead:DeprecationWarning ignore:'pkgutil.get_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec\(\) instead:DeprecationWarning - # 3.14 deprecation warnings, remove after support for Python 3.14 is dropped - ignore:.*asyncio.iscoroutinefunction.*is deprecated and slated for removal in Python 3.16:DeprecationWarning - ignore:.*asyncio.get_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning - ignore:.*asyncio.set_event_loop_policy.*is deprecated and slated for removal in Python 3.16:DeprecationWarning # Remove warning once https://github.com/protocolbuffers/protobuf/issues/17345 is fixed ignore:.*Please use message_factory.GetMessageClass\(\) instead. SymbolDatabase.GetPrototype\(\) will be removed soon.:UserWarning # Remove warning once https://github.com/googleapis/gapic-generator-python/issues/2046 is fixed diff --git a/packages/google-cloud-logging/testing/constraints-3.10.txt b/packages/google-cloud-logging/testing/constraints-3.10.txt index 90f4a9bf003d..3ff5c516b82a 100644 --- a/packages/google-cloud-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-logging/testing/constraints-3.10.txt @@ -1,12 +1,16 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file, +# pinning their versions to their lower bounds. +# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", +# then this file should have google-cloud-foo==1.14.0 google-api-core==2.17.1 google-auth==2.14.1 google-cloud-appengine-logging==0.1.3 google-cloud-audit-log==0.3.1 google-cloud-core==2.0.0 grpc-google-iam-v1==0.12.4 -grpcio==1.75.1 -grpcio==1.59.0 opentelemetry-api==1.16.0 -proto-plus==1.25.0 +grpcio==1.59.0 proto-plus==1.22.3 -protobuf==4.25.8 \ No newline at end of file +protobuf==4.25.8 diff --git a/packages/google-cloud-logging/tests/unit/test_logger.py b/packages/google-cloud-logging/tests/unit/test_logger.py index 2b66bcda1020..852a45e38b35 100644 --- a/packages/google-cloud-logging/tests/unit/test_logger.py +++ b/packages/google-cloud-logging/tests/unit/test_logger.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys import unittest from copy import deepcopy from datetime import datetime, timedelta, timezone @@ -466,6 +467,8 @@ def test_log_w_dict_resource(self): Users should be able to input a dictionary with type and labels instead of a Resource object """ + import pytest + MESSAGE = "hello world" client = _Client(self.PROJECT) api = client.logging_api = _DummyLoggingAPI() @@ -1770,6 +1773,10 @@ def test_context_mgr_failure(self): self.assertEqual(list(batch.entries), UNSENT) self.assertIsNone(api._write_entries_called_with) + @pytest.mark.skipif( + sys.version_info < (3, 8), + reason="InvalidArgument init with details requires python3.8+", + ) def test_append_context_to_error(self): """ If an InvalidArgument exception contains info on the log that threw it, @@ -1819,6 +1826,10 @@ def test_append_context_to_error(self): err.message, starting_message, "message should have been unchanged" ) + @pytest.mark.skipif( + sys.version_info < (3, 8), + reason="InvalidArgument init with details requires python3.8+", + ) def test_batch_error_gets_context(self): """ Simulate an InvalidArgument sent as part of a batch commit, to ensure From ed16b9b7cdba2791fbb4387fa61a2749abcadaf4 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 06:21:16 -0400 Subject: [PATCH 26/28] refactor(logging): refine post-processing constraints replacement rule to use minimal bookend anchors --- .../client-post-processing/logging-integration.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.librarian/generator-input/client-post-processing/logging-integration.yaml b/.librarian/generator-input/client-post-processing/logging-integration.yaml index c64fb55fff2a..5aaeae52331c 100644 --- a/.librarian/generator-input/client-post-processing/logging-integration.yaml +++ b/.librarian/generator-input/client-post-processing/logging-integration.yaml @@ -52,15 +52,9 @@ replacements: "packages/google-cloud-logging/testing/constraints-3.10.txt" ] before: | - # then this file should have google-cloud-foo==1.14.0 - google-api-core==2.17.1 google-auth==2.14.1 grpcio==1.59.0 - proto-plus==1.22.3 - protobuf==4.25.8 after: | - # then this file should have google-cloud-foo==1.14.0 - google-api-core==2.17.1 google-auth==2.14.1 google-cloud-appengine-logging==0.1.3 google-cloud-audit-log==0.3.1 @@ -68,8 +62,6 @@ replacements: grpc-google-iam-v1==0.12.4 opentelemetry-api==1.16.0 grpcio==1.59.0 - proto-plus==1.22.3 - protobuf==4.25.8 count: 1 - paths: [ "packages/google-cloud-logging/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py", From 18ba00cdbdf6b60dd5695e36069c7cfcebb41349 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 06:33:41 -0400 Subject: [PATCH 27/28] fix(gapic-generator): align _UUID4_RE jinja condition to prevent NameError in generated tests --- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- .../tests/unit/gapic/logging_v2/test_config_service_v2.py | 3 --- .../tests/unit/gapic/logging_v2/test_logging_service_v2.py | 3 --- .../tests/unit/gapic/logging_v2/test_metrics_service_v2.py | 3 --- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index fcbeeff213b5..c68b390b7c84 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -107,7 +107,7 @@ CRED_INFO_JSON = { "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} _UUID4_RE = re.compile(r"{{ uuid4_re }}") {% endif %} diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index f5ad9afa69ca..078a6abbcf1f 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -71,9 +71,6 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -_UUID4_RE = re.compile( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" -) async def mock_async_gen(data, chunk_size=1): diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index a7996c112686..4688658c8e00 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -71,9 +71,6 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -_UUID4_RE = re.compile( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" -) async def mock_async_gen(data, chunk_size=1): diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index fe21c624a419..330d9998ef94 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -70,9 +70,6 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -_UUID4_RE = re.compile( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" -) async def mock_async_gen(data, chunk_size=1): From 52fa6eb52a056ce1e42b298af0d1107422cf11f1 Mon Sep 17 00:00:00 2001 From: chalmer lowe Date: Wed, 27 May 2026 06:46:43 -0400 Subject: [PATCH 28/28] revert(logging): restore templates and generated files back to main baseline --- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- .../tests/unit/gapic/logging_v2/test_config_service_v2.py | 3 +++ .../tests/unit/gapic/logging_v2/test_logging_service_v2.py | 3 +++ .../tests/unit/gapic/logging_v2/test_metrics_service_v2.py | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index c68b390b7c84..fcbeeff213b5 100644 --- a/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -107,7 +107,7 @@ CRED_INFO_JSON = { "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} _UUID4_RE = re.compile(r"{{ uuid4_re }}") {% endif %} diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index 078a6abbcf1f..f5ad9afa69ca 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -71,6 +71,9 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" +) async def mock_async_gen(data, chunk_size=1): diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 4688658c8e00..a7996c112686 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -71,6 +71,9 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" +) async def mock_async_gen(data, chunk_size=1): diff --git a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 330d9998ef94..fe21c624a419 100644 --- a/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/packages/google-cloud-logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -70,6 +70,9 @@ "principal": "service-account@example.com", } CRED_INFO_STRING = json.dumps(CRED_INFO_JSON) +_UUID4_RE = re.compile( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" +) async def mock_async_gen(data, chunk_size=1):